BeforeBasketDeliveryMethods
This event will be fired right before getting the list with available delivery methods for specific basket.
BeforeBasketDeliveryMethodsEventSubscriber
<?php
declare(strict_types=1);
namespace Full\Qualified\Namespace;
use OxidEsales\GraphQL\Storefront\Basket\Event\BeforeBasketDeliveryMethods;
use Symfony\Component\EventDispatcher\EventSubscriberInterface;
class DeveloperBeforeBasketDeliveryMethodsEventSubscriber implements EventSubscriberInterface
{
public function handle(BeforeBasketDeliveryMethods $event): BeforeBasketDeliveryMethods
{
//get the user basket id from event
$userBasketId = (string) $event->getBasketId();
//do something
return $event;
}
public static function getSubscribedEvents()
{
return [
'OxidEsales\GraphQL\Storefront\Basket\Event\BeforeBasketDeliveryMethods' => 'handle'
];
}
}
Important
The code above is only an example. In case you need to handle the BeforeBasketDeliveryMethods
event,
please adapt to your needs.
services.yaml
services:
_defaults:
public: false
autowire: true
Full\Qualified\Namespace\DeveloperBeforeBasketDeliveryMethodsEventSubscriber:
class: Full\Qualified\Namespace\DeveloperBeforeBasketDeliveryMethodsEventSubscriber
tags: ['kernel.event_subscriber']