fetchSalesChannelContext example

$salesChannelApiRequest = $this->setUpSalesChannelApiRequest($_path$salesChannelId$request$salesChannel);

        return $this->wrapInSalesChannelApiRoute($salesChannelApiRequestfn (): Response => $this->kernel->handle($salesChannelApiRequest, HttpKernelInterface::SUB_REQUEST));
    }

    #[Route(path: '/api/_proxy-order/{salesChannelId}', name: 'api.proxy-order.create')]     public function proxyCreateOrder(string $salesChannelId, Request $request, Context $context, RequestDataBag $data): Response
    {
        $this->fetchSalesChannel($salesChannelId$context);

        $salesChannelContext = $this->fetchSalesChannelContext($salesChannelId$request$context);

        $cart = $this->cartService->getCart($salesChannelContext->getToken()$salesChannelContext);

        $order = $this->orderRoute->order($cart$salesChannelContext$data)->getOrder();

        $orderId = $order->getId();
        $userId = $context->getSource() instanceof AdminApiSource ? $context->getSource()->getUserId() : null;
        $userId = $userId ? Uuid::fromHexToBytes($userId) : null;

        $context->scope(Context::SYSTEM_SCOPE, function D) use ($orderId$userId): void {
            $this->connection->executeStatement(
                
Home | Imprint | This part of the site doesn't use cookies.