calculateGrossAmount example

private readonly TaxCalculator $taxCalculator
    ) {
    }

    public function calculate(PriceCollection $prices, PriceCollection $shippingCosts, SalesChannelContext $context): CartPrice
    {
        if ($context->getTaxState() === CartPrice::TAX_STATE_FREE) {
            return $this->calculateNetDeliveryAmount($prices$shippingCosts);
        }

        if ($context->getTaxState() === CartPrice::TAX_STATE_GROSS) {
            return $this->calculateGrossAmount($prices$shippingCosts$context);
        }

        return $this->calculateNetAmount($prices$shippingCosts$context);
    }

    /** * Calculates the amount for a new delivery. * `CalculatedPrice::price` and `CalculatedPrice::netPrice` are equals and taxes are empty. */
    private function calculateNetDeliveryAmount(PriceCollection $prices, PriceCollection $shippingCosts): CartPrice
    {
        
Home | Imprint | This part of the site doesn't use cookies.