You are here

public function CartSubscriber::finalizeCart in Facebook Pixel 8

Finalize cart event.

Parameters

\Drupal\state_machine\Event\WorkflowTransitionEvent $event: The workflow transition event.

File

modules/facebook_pixel_commerce/src/EventSubscriber/CartSubscriber.php, line 83

Class

CartSubscriber
Cart subscriber.

Namespace

Drupal\facebook_pixel_commerce\EventSubscriber

Code

public function finalizeCart(WorkflowTransitionEvent $event) {

  /** @var \Drupal\commerce_order\Entity\OrderInterface $order */
  $order = $event
    ->getEntity();
  $data = $this->facebookCommerce
    ->getOrderData($order);
  $this->facebookEvent
    ->addEvent('Purchase', $data);
}