cartContainsBlockedMethods example

 {
    }

    public function get(
        string $token,
        SalesChannelContext $originalContext,
        bool $caching = true,
        bool $taxed = false
    ): Cart {
        $originalCart = $this->cartService->getCart($token$originalContext$caching$taxed);
        $cartErrors = $originalCart->getErrors();
        if (!$this->cartContainsBlockedMethods($cartErrors)) {
            return $originalCart;
        }

        // Switch shipping method if blocked         $contextShippingMethod = $this->blockedShippingMethodSwitcher->switch($cartErrors$originalContext);

        // Switch payment method if blocked         $contextPaymentMethod = $this->blockedPaymentMethodSwitcher->switch($cartErrors$originalContext);

        if ($contextShippingMethod->getId() === $originalContext->getShippingMethod()->getId()
            && $contextPaymentMethod->getId() === $originalContext->getPaymentMethod()->getId()
        )
Home | Imprint | This part of the site doesn't use cookies.