public function XquantityStockOrderEventSubscriber::onOrderDelete in Commerce Extended Quantity 8
Performs a stock transaction on an order delete event.
This happens on PREDELETE since the items are not available after DELETE.
Parameters
\Drupal\commerce_order\Event\OrderEvent $event: The order event.
File
- modules/
xquantity_stock/ src/ EventSubscriber/ XquantityStockOrderEventSubscriber.php, line 95
Class
- XquantityStockOrderEventSubscriber
- Commerce order event subscriber.
Namespace
Drupal\xquantity_stock\EventSubscriberCode
public function onOrderDelete(OrderEvent $event) {
$order = $event
->getOrder();
foreach ($order
->getItems() as $order_item) {
$this
->updateStock($order, $order_item, TRUE);
}
}