You are here

protected function IncrementStockAction::incrementCallback in Ubercart 8.4

Increment a product's stock.

Parameters

\Drupal\uc_order\OrderProductInterface $product: The product whose stock is being adjusted.

mixed $key: The array key currently being modified, needed so this function can be used as a callback of array_walk().

\Drupal\uc_order\OrderInterface $order: Order object.

File

uc_stock/src/Plugin/RulesAction/IncrementStockAction.php, line 48

Class

IncrementStockAction
Provides a 'Increment stock' action.

Namespace

Drupal\uc_stock\Plugin\RulesAction

Code

protected function incrementCallback(OrderProductInterface $product, $key, OrderInterface $order) {
  $product->qty->value = -$product->qty->value;
  return uc_stock_adjust_product_stock($product, $key, $order);
}