Hidden Tax Calculation
Hidden tax conditions
Hidden Tax is the amount of VAT that a discount amount has. It will be non-zero when all of these conditions are true:
- Catalog prices include tax
- The VAT rate is not zero
- There is a discount present
Thus, when there is a discount that has tax embedded in it, Magento computes a hidden tax that is added back in order to compute the discounted price.
discountedItemPrice = fullPriceWithOutTax - discountAmountOnFullPriceWithoutTax + vatAmountOnDiscountedPrice + hiddenTax
Example
- Full price of item, with tax included: $100
- VAT at: 20%
- Discount of 10% applied on item price excluding taxes:
Invalid Expected Result
- Item price after tax without discount=100 USD
- Item price before tax without discount=100/1.2=83.33 USD
- Discount=83.33*0.1=8.33 USD
- Tax=(83.33-8.33)*0.2=15 USD (invalid)
- Order Total Excluding Tax=83.33-8.33=75 USD (invalid)
- Order Total Including Tax=75+15=90 USD (invalid)
Valid Actual Result in Cart
Hidden Tax Tax Calculation in Cart
Valid Calculations
-
Full price of item, without taxes is: $100 / 1.2 = $83.33
-
VAT amount on the full item price is: $100 - $83.33 = $16.67
Can also be calculated as: $100 * (1 - 1/1.2).
-
Discount of 10% on $83.33 is: $8.33 (when we don't discount tax)
-
Discounted price of item with tax is: $100 - $8.33 = $91.67
This is the customer’s perception of how discounts are applied.
-
Discounted price of item, without taxes is: $91.67 / 1.2 = $76.39
-
VAT amount on the discounted price is: $91.67 - $76.39 = $15.28 (valid)
Can also be calculated as: $91.67 * (1 - 1/1.2).
-
Hidden tax or Discount Tax Compensation is the difference between the VAT amount of the full price versus discounted price: $16.67 - $15.28 = $1.39
Another way to look at this: hidden tax is the VAT amount carried within the $8.33 discount: $8.33 * (1 - 1/1.2).
-
How the customer usually understands the discounted price (Order Total):
Full price of item including taxes less the discount amount: $100 - $8.33 = $91.67
-
How Magento calculates the discounted price (see earlier for formula):
$83.33 - $8.33 + 15.28 + 1.39 = $91.67*