<?php declare(strict_types=1);
namespace Okeonline\MyKeje\Storefront\Subscriber;
use Shopware\Core\Checkout\Cart\Order\CartConvertedEvent;
use Symfony\Component\EventDispatcher\EventSubscriberInterface;
class CartConvertedEventSubscriber implements EventSubscriberInterface
{
public static function getSubscribedEvents(): array
{
return [
CartConvertedEvent::class => 'setOrderOrigin'
];
}
public function setOrderOrigin(CartConvertedEvent $event)
{
$currentConvertedCart = $event->getConvertedCart();
$currentConvertedCart['customFields']['oo_order_origin'] = 'portal';
$event->setConvertedCart($currentConvertedCart);
}
}