I have product with Price 6.50 € which includes 24% VAT in it.
When I add it to cart, for 1 quantity the price shows correct.
Net value 5.24 €
VAT 24% 1.26 €
Total value 6,50 €
Now if I add 3 products to cart, the total becomes incorrect.
Net value 15.72 €
VAT 24% 3.77 €
Total value 19,49 €
Which is 0.01€ less than correct subtotal. It should be,
Net value 15.72 €
VAT 24% 3.78 €
Total value 19,50 €
Here you can see that VAT value is calculated wrong. It calculates 24% of 15.72 which is 3.77 and its correct, but it should be calculated on each product and then summed up to be 3.78
UPDATES
I have tried by setting Unit Price
System -> Configuration -> Tax -> Calculation Settings
But it gives me results like,
Net value 15.72 €
VAT 24% 3.06 €
Total value 18.78 €
It is because we are using a module Additional Fee extension on site, which adds 1 € to each product price. So I need to use Row Total
to add Additional Fee data. SO I cannot use Unit Price
, it gets Product Price which is 4.24 € to calculate Tax amount
Is there any other way?
Best Answer
I have checked with Default Magento functionality and found that your issue can be resolved by overriding two functions:
Mage_Tax_Model_Sales_Total_Quote_Tax::_calcRowTaxAmount()
Mage_Tax_Model_Sales_Total_Quote_Subtotal::_rowBaseCalculation()
Create a module Mymodule_Updatetax which will override these functions.
And,
The trick here is that we are calculating the Tax amount based on product price and then make a sum of it. So if your product price is 6.50 €, and Your Tax percent is 24%, it will first calculate tax for each of your product price + your Additional fee amount and then make a sum of all values.
So total will be,