You are here

public function PixelSubscriber::addToWishlist in Simple Facebook Pixel 8

Adds AddToWishlist event. Using Commerce Wishlist module.

Parameters

\Symfony\Component\EventDispatcher\Event $event: The add to wishlist event.

File

src/EventSubscriber/PixelSubscriber.php, line 135

Class

PixelSubscriber
Class PixelSubscriber.

Namespace

Drupal\simple_facebook_pixel\EventSubscriber

Code

public function addToWishlist(Event $event) {
  if ($this->pixelBuilder
    ->isEnabled() && $this->configFactory
    ->get('add_to_wishlist_enabled')) {
    $product_variation = $event
      ->getEntity();
    $quantity = $event
      ->getQuantity();
    $this
      ->addItem($product_variation, $quantity, 'AddToWishlist');
  }
}