You are here

public function CartEventSubscriber::onCartOrderItemRemove in Commerce Core 8.2

Creates a log when an order item has been removed from the cart.

Parameters

\Drupal\commerce_cart\Event\CartOrderItemRemoveEvent $event: The cart event.

File

modules/log/src/EventSubscriber/CartEventSubscriber.php, line 60

Class

CartEventSubscriber

Namespace

Drupal\commerce_log\EventSubscriber

Code

public function onCartOrderItemRemove(CartOrderItemRemoveEvent $event) {
  $cart = $event
    ->getCart();
  $this->logStorage
    ->generate($cart, 'cart_item_removed', [
    'purchased_entity_label' => $event
      ->getOrderItem()
      ->label(),
  ])
    ->save();
}