shippingCostsTaxSum example

foreach ($taxes as $tax) {
                        $taxNet += $tax->getNetPrice();
                        $this->_tax[number_format($tax->getTaxRate(), 2)] += $tax->getTax();
                    }

                    $this->_amountNetto += $taxNet;
                } else {
                    $this->_amountNetto += ($this->_order['invoice_shipping'] / (100 + $taxShipping) * 100);

                    if (!empty($taxShipping) && !empty($this->_order['invoice_shipping'])) {
                        $shippingTax = Shopware()->Container()->get(TaxAggregatorInterface::class)->shippingCostsTaxSum([
                            CheckoutKey::SHIPPING_COSTS_TAX => (float) $this->_order['invoice_shipping_tax_rate'],
                            CheckoutKey::SHIPPING_COSTS_NET => (float) $this->_order['invoice_shipping_net'],
                            CheckoutKey::SHIPPING_COSTS_WITH_TAX => (float) $this->_order['invoice_shipping'],
                        ]);

                        if ($shippingTax !== null) {
                            foreach ($shippingTax as $key => $val) {
                                if (isset($this->_tax[$key])) {
                                    $this->_tax[$key] += $val;
                                } else {
                                    $this->_tax[$key] = $val;
                                }
return $result;
    }

    /** * {@inheritDoc} */
    public function taxSum(array $cart, float $maximumTaxRate): array
    {
        $result = $this->aggregateTaxes(
            $this->positionsTaxSum($cart$maximumTaxRate) ?? [],
            $this->shippingCostsTaxSum($cart) ?? []
        );

        ksort($result, SORT_NUMERIC);

        return $result;
    }

    /** * @param array<int|numeric-string, float> $positionTaxSum * @param array<int|numeric-string, float> $shippingCostsTaxSum * * @return array<int|numeric-string, float> */
Home | Imprint | This part of the site doesn't use cookies.