You are here

public function StockAvailabilityChecker::check in Commerce Stock 8

Checks the availability of the given order item.

Parameters

\Drupal\commerce_order\Entity\OrderItemInterface $order_item: The order item.

\Drupal\commerce\Context $context: The context.

Return value

\Drupal\commerce_order\AvailabilityResult The availability result. AvailabilityResult::unavailable() should be used to indicate that the given order item is "unavailable" for purchase. Note that an optional "reason" can be specified.

Overrides AvailabilityCheckerInterface::check

File

src/StockAvailabilityChecker.php, line 48

Class

StockAvailabilityChecker
The entry point for availability checking through Commerce Stock.

Namespace

Drupal\commerce_stock

Code

public function check(OrderItemInterface $order_item, Context $context) {
  return (new AvailabilityResult(TRUE))
    ->isNeutral();
}