Relja
Relja

Reputation: 678

Magento: how to check if onepage or multipage checkout was used?

I have a trigger attached to completeOrder event, so through the $observer object I can fetch the quote and current order.

The question is - how can I check with 100% accuracy whether the user used onepage checkout or multipage checkout?

If he used multipage then 2 or more orders will be created, and my trigger will run a couple of times.

One way of checking stuff is to check the total number of addresses from quote object

  $quote->getAllAddresses();

so if it has more than 2 addresses (more than just 1 billing and 1 shipping), then it's multipage, otherwise onepage. The problem is if through the multipage checkout process one of the orders is virtual, and the other is regular. Virtual orders do not have addresses, so my condition won't work in that case.

Upvotes: 0

Views: 1498

Answers (1)

Sergey
Sergey

Reputation: 1494

If you can get current Order, then fetch order quote object.
Then you can use $quote->getIsMultiShipping()

Upvotes: 1

Related Questions