BeforeBasketRemove

This event belongs to the graphql-storefront module. It will be fired before a basket is removed and holds the ID of the the user basket.

BeforeBasketRemoveEventSubscriber

<?php

declare(strict_types=1);

namespace Full\Qualified\Namespace;

use OxidEsales\GraphQL\Storefront\Basket\Event\BeforeBasketRemove;
use Symfony\Component\EventDispatcher\EventSubscriberInterface;

class DeveloperBeforeBasketRemoveEventSubscriber implements EventSubscriberInterface
{
    public function handle(BeforeBasketRemove $event): BeforeBasketRemove
    {
        //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\BeforeBasketRemove' => 'handle'
        ];
    }
}

Important

The code above is only an example. In case you need to handle the BeforeBasketRemove event, please adapt to your needs.

services.yaml

services:

    _defaults:
        public: false
        autowire: true

    Full\Qualified\Namespace\DeveloperBeforeBasketRemoveEventSubscriber:
        class: Full\Qualified\Namespace\DeveloperBeforeBasketRemoveEventSubscriber
        tags: ['kernel.event_subscriber']