BeforePlaceOrder

This event belongs to the graphql-storefront module. It will be fired before an order is placed and holds the ID of the the user basket which is to be ordered. A module can then do final preparations on that saved user basket.

PlaceOrderEventSubscriber

<?php

declare(strict_types=1);

namespace Full\Qualified\Namespace;

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

class DeveloperBeforePlaceOrderEventSubscriber extends AbstractShopAwareEventSubscriber
{
    public function handle(BeforePlaceOrder $event): BeforePlaceOrder
    {
        //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\BeforePlaceOrder' => 'handle'
        ];
    }
}

Important

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

services.yaml

services:

    _defaults:
        public: false
        autowire: true

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