detectTaxType example



        return $this->currencyFactor[$currencyId] = (float) $currencyFactor;
    }

    private function validateTaxFree(SalesChannelContext $context, Cart $cart, CartBehavior $behaviorContext): Cart
    {
        $totalCartNetAmount = $cart->getPrice()->getPositionPrice();
        if ($context->getTaxState() === CartPrice::TAX_STATE_GROSS) {
            $totalCartNetAmount = $totalCartNetAmount - $cart->getLineItems()->getPrices()->getCalculatedTaxes()->getAmount();
        }
        $taxState = $this->detectTaxType($context$totalCartNetAmount);
        $previous = $context->getTaxState();
        if ($taxState === $previous) {
            return $cart;
        }

        $context->setTaxState($taxState);
        $cart->setData(null);
        $cart = $this->processor->process($cart$context$behaviorContext);
        if ($previous !== CartPrice::TAX_STATE_FREE) {
            $context->setTaxState($previous);
        }

        
Home | Imprint | This part of the site doesn't use cookies.