I am having a little misunderstanding while trying to trigger a function after the creation of a new order in shopware6 but nothing happens.
My syntax is maybe so Shopware5 because I am really new to SW6.
Here is my code (only for testing) :
<?php
namespace Emakers\TransmissionPlugin\Subscriber;
use Enlight_Hook_HookArgs;
use Symfony\Component\EventDispatcher\EventSubscriberInterface;
use Symfony\Component\HttpKernel\KernelEvents;
class OrderSubscriber implements EventSubscriberInterface
{
public static function getSubscribedEvents()
{
// return the subscribed events, their methods and priorities
return [
KernelEvents::EXCEPTION => [
['OrderEvents::ORDER_WRITTEN_EVENT::RESPONSE' => 'onOrderCheckout'],
],
];
}
public function onOrderCheckout(Enlight_Hook_HookArgs $args): void
{
die('TEST OK');
}
}
Is there somewhere I can find all the events related to orders? Maybe the one I am using is incorrect.
Thanks
The issue was coming from the services.xml file, You have to add this to your subscriber service :
<tag name="kernel.event_listener" />
<tag name="kernel.event_subscriber" />