You are here

public function XquantityStockOrderEventSubscriber::onOrderCancel in Commerce Extended Quantity 8

Performs a stock transaction for an order Cancel event.

Parameters

\Drupal\state_machine\Event\WorkflowTransitionEvent $event: The order workflow event.

File

modules/xquantity_stock/src/EventSubscriber/XquantityStockOrderEventSubscriber.php, line 80

Class

XquantityStockOrderEventSubscriber
Commerce order event subscriber.

Namespace

Drupal\xquantity_stock\EventSubscriber

Code

public function onOrderCancel(WorkflowTransitionEvent $event) {
  $order = $event
    ->getEntity();
  foreach ($order
    ->getItems() as $order_item) {
    $this
      ->updateStock($order, $order_item, TRUE);
  }
}