custom/plugins/MyKeje/src/Storefront/Subscriber/CartConvertedEventSubscriber.php line 18

Open in your IDE?
  1. <?php declare(strict_types=1);
  2. namespace Okeonline\MyKeje\Storefront\Subscriber;
  3. use Shopware\Core\Checkout\Cart\Order\CartConvertedEvent;
  4. use Symfony\Component\EventDispatcher\EventSubscriberInterface;
  5. class CartConvertedEventSubscriber implements EventSubscriberInterface
  6. {
  7.     public static function getSubscribedEvents(): array
  8.     {
  9.         return [
  10.             CartConvertedEvent::class => 'setOrderOrigin'
  11.         ];
  12.     }
  13.     public function setOrderOrigin(CartConvertedEvent $event)
  14.     {
  15.         $currentConvertedCart $event->getConvertedCart();
  16.         $currentConvertedCart['customFields']['oo_order_origin'] = 'portal';
  17.         $event->setConvertedCart($currentConvertedCart);
  18.     }
  19. }