Skip to content

Commit

Permalink
Fix state machine exception on order creation
Browse files Browse the repository at this point in the history
When dealing with virtual products or  ( when only one shipping method is enabled and channel skipping_shipping_step_allowed )
  • Loading branch information
maciekpaprocki authored and GSadee committed Feb 25, 2022
1 parent b53e428 commit c1f47db
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/EventListener/OrderCreationListener.php
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,9 @@ public function completeOrderBeforeCreation(GenericEvent $event): void

$stateMachine = $this->stateMachineFactory->get($order, 'sylius_order_checkout');
$stateMachine->apply(OrderCheckoutTransitions::TRANSITION_ADDRESS);
$stateMachine->apply(OrderCheckoutTransitions::TRANSITION_SELECT_SHIPPING);
if ($stateMachine->can(OrderCheckoutTransitions::TRANSITION_SELECT_SHIPPING)) {
$stateMachine->apply(OrderCheckoutTransitions::TRANSITION_SELECT_SHIPPING);
}
if ($stateMachine->can(OrderCheckoutTransitions::TRANSITION_SELECT_PAYMENT)) {
$stateMachine->apply(OrderCheckoutTransitions::TRANSITION_SELECT_PAYMENT);
}
Expand Down

0 comments on commit c1f47db

Please sign in to comment.