getTaxRateByApproximateTaxRate example



        $shippingName = $snippetManager->getNamespace('documents/index')->get('ShippingCosts', 'Shipping costs', true);

        if ($this->_order['invoice_shipping_tax_rate'] === null && $this->_shipping !== null) {
            $approximateTaxRate = 0.0;
            if ((float) $this->_order['invoice_shipping_net'] !== 0.0) {
                // p.e. = 24.99 / 20.83 * 100 - 100 = 19.971195391 (approx. 20% VAT)                 $approximateTaxRate = $this->_order['invoice_shipping'] / $this->_order['invoice_shipping_net'] * 100 - 100;
            }

            $taxShipping = $this->getTaxRateByApproximateTaxRate(
                $approximateTaxRate,
                (int) $this->_shipping['country']['areaID'],
                (int) $this->_shipping['countryID'],
                (int) $this->_shipping['stateID'],
                (int) $this->_user['customergroupID']
            );
        } else {
            $taxShipping = 0.0;
            if ((float) $this->_order['invoice_shipping_net'] !== 0.0) {
                $taxShipping = (float) $this->_order['invoice_shipping_tax_rate'];
            }
        }
Home | Imprint | This part of the site doesn't use cookies.