You are here

public function DefaultCheckoutFlowResolver::resolve in Commerce Core 8.2

Resolves the checkout flow.

Parameters

\Drupal\commerce_order\Entity\OrderInterface $order: The order that is being checked out.

Return value

\Drupal\commerce_checkout\Entity\CheckoutFlowInterface The checkout flow, if resolved. Otherwise NULL, indicating that the next resolver in the chain should be called.

Overrides CheckoutFlowResolverInterface::resolve

File

modules/checkout/src/Resolver/DefaultCheckoutFlowResolver.php, line 33

Class

DefaultCheckoutFlowResolver
Returns the order type's default checkout flow.

Namespace

Drupal\commerce_checkout\Resolver

Code

public function resolve(OrderInterface $order) {

  /** @var \Drupal\commerce_order\Entity\OrderTypeInterface $order_type */
  $order_type = $this->entityTypeManager
    ->getStorage('commerce_order_type')
    ->load($order
    ->bundle());
  $checkout_flow_id = $order_type
    ->getThirdPartySetting('commerce_checkout', 'checkout_flow', 'default');
  $checkout_flow = $this->entityTypeManager
    ->getStorage('commerce_checkout_flow')
    ->load($checkout_flow_id);
  return $checkout_flow;
}