custom/plugins/clerkio64/src/Core/Checkout/Event/LineItemAddedSubscriber.php line 20

Open in your IDE?
  1. <?php declare(strict_types=1);
  2. namespace CLERKIO64\clerkio64\Core\Checkout\Event;
  3. use Shopware\Core\Checkout\Cart\Event\LineItemAddedEvent;
  4. use Shopware\Core\Framework\Struct\ArrayStruct;
  5. use Shopware\Core\Framework\Struct\Struct;
  6. use Symfony\Component\EventDispatcher\EventSubscriberInterface;
  7. use Symfony\Component\HttpFoundation\Session\Session;
  8. class LineItemAddedSubscriber implements EventSubscriberInterface
  9. {
  10.     public static function getSubscribedEvents(): array
  11.     {
  12.         return [
  13.             LineItemAddedEvent::class => 'onLineItemAdded',
  14.         ];
  15.     }
  16.     public function onLineItemAdded(LineItemAddedEvent $event): void
  17.     {
  18.         $event->getContext()->addExtension('product_count', new ArrayStruct());
  19.     }
  20. }