public function CartEventSubscriber::cartItemUpdate in Mailchimp E-Commerce 8
Respond to event fired after updating a cart item.
File
- modules/
mailchimp_ecommerce_commerce/ src/ EventSubscriber/ CartEventSubscriber.php, line 113
Class
- CartEventSubscriber
- Event Subscriber for Commerce Carts.
Namespace
Drupal\mailchimp_ecommerce_commerce\EventSubscriberCode
public function cartItemUpdate(CartOrderItemUpdateEvent $event) {
/** @var \Drupal\commerce_order\Entity\Order $order */
$order = $event
->getCart();
/** @var \Drupal\commerce_order\Entity\OrderItem $order_item */
$order_item = $event
->getOrderItem();
$product = $this->order_handler
->buildProduct($order_item);
$this->cart_handler
->updateCartLine($order
->id(), $order_item
->id(), $product);
}