You are here

function xquantity_stock_xquantity_availability_check_alter in Commerce Extended Quantity 8

Implements hook_TYPE_alter().

Allows to check if the current product variation in stock.

See also

\Drupal\xquantity_stock\XquantityStockAvailabilityChecker::check()

File

modules/xquantity_stock/xquantity_stock.module, line 29
Contains xquantity_stock.module.

Code

function xquantity_stock_xquantity_availability_check_alter(&$available, $quantity, $context) {

  // Apply your own logic for checking.
  //   if ($context['context']->getData('xquantity') && ($context['xquantity_stock']->value < 123)) {
  //     $context['entity']->set($context['xquantity_stock']->getName(), 456)->save();
  //     $available = TRUE;
  //   }
}