BeforeRemoveItem

This event belongs to the graphql-storefront module. It will be fired before an basket item is removed and holds the ID of the the user basket, ID of the basket item for remove and amount.

BeforeRemoveItemEventSubscriber

<?php

declare(strict_types=1);

namespace Full\Qualified\Namespace;

use OxidEsales\EshopCommunity\Internal\Framework\Event\AbstractShopAwareEventSubscriber;
use OxidEsales\GraphQL\Storefront\Basket\Event\BeforeRemoveItem;

class DeveloperBeforeRemoveItemEventSubscriber extends AbstractShopAwareEventSubscriber
{
    public function handle(BeforeRemoveItem $event): BeforeRemoveItem
    {
        //get the user basket id from event
        $userBasketId = (string) $event->getBasketId();

        //get the user basket item id from event
        $basketItemId = (string) $event->getBasketItemId();

        //get the user basket item amount from event
        $amount = (float) $event->getAmount();

        //do something

        return $event;
    }

    public static function getSubscribedEvents()
    {
        return [
            'OxidEsales\GraphQL\Storefront\Basket\Event\BeforeRemoveItem' => 'handle'
        ];
    }
}

Important

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

services.yaml

services:

    _defaults:
        public: false
        autowire: true

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