You are here

public function ChainOrderTypeResolver::resolve in Commerce Core 8.2

Resolves the order type.

Parameters

\Drupal\commerce_order\Entity\OrderItemInterface $order_item: The order item being added to an order.

Return value

string|null The order type ID, if resolved. Otherwise NULL, indicating that the next resolver in the chain should be called.

Overrides OrderTypeResolverInterface::resolve

File

modules/order/src/Resolver/ChainOrderTypeResolver.php, line 46

Class

ChainOrderTypeResolver
Default implementation of the chain order type resolver.

Namespace

Drupal\commerce_order\Resolver

Code

public function resolve(OrderItemInterface $order_item) {
  foreach ($this->resolvers as $resolver) {
    $result = $resolver
      ->resolve($order_item);
    if ($result) {
      return $result;
    }
  }
}