You are here

public function CartEventSubscriber::onCartEmpty in Commerce Core 8.2

Removes coupons when the cart has been emptied.

Parameters

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

File

modules/promotion/src/EventSubscriber/CartEventSubscriber.php, line 27

Class

CartEventSubscriber

Namespace

Drupal\commerce_promotion\EventSubscriber

Code

public function onCartEmpty(CartEmptyEvent $event) {
  $event
    ->getCart()
    ->set('coupons', []);
}