You are here

function commerce_cart_commerce_order_delete in Commerce Core 8.2

Same name and namespace in other branches
  1. 7 modules/cart/commerce_cart.module \commerce_cart_commerce_order_delete()

Implements hook_ENTITY_TYPE_delete().

Removes deleted carts from the anonymous user's session.

File

modules/cart/commerce_cart.module, line 117
Implements the shopping cart system and add to cart features.

Code

function commerce_cart_commerce_order_delete(OrderInterface $order) {
  if (!empty($order->cart->value)) {
    \Drupal::service('commerce_cart.cart_session')
      ->deleteCartId($order
      ->id());
  }
}