DefaultCheckoutFlowResolver.php in Commerce Core 8.2
File
modules/checkout/src/Resolver/DefaultCheckoutFlowResolver.php
View source
<?php
namespace Drupal\commerce_checkout\Resolver;
use Drupal\commerce_order\Entity\OrderInterface;
use Drupal\Core\Entity\EntityTypeManagerInterface;
class DefaultCheckoutFlowResolver implements CheckoutFlowResolverInterface {
protected $entityTypeManager;
public function __construct(EntityTypeManagerInterface $entity_type_manager) {
$this->entityTypeManager = $entity_type_manager;
}
public function resolve(OrderInterface $order) {
$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;
}
}