You are here

public function AjaxAddToCartPopupSubscriber::onAddToCart in Commerce Ajax Add to Cart 8

Initializes the purchased entity.

Parameters

\Drupal\commerce_cart\Event\CartEntityAddEvent $event: The add to cart event.

File

modules/dc_ajax_add_cart_popup/src/EventSubscriber/AjaxAddToCartPopupSubscriber.php, line 84

Class

AjaxAddToCartPopupSubscriber
Event subscriber to display a popup when items are added to cart via AJAX.

Namespace

Drupal\dc_ajax_add_cart_popup\EventSubscriber

Code

public function onAddToCart(CartEntityAddEvent $event) {
  $this->purchasedEntity = $event
    ->getEntity();
}