[DEV] - Wrong tax calculation and custom prices excl. tax?

When prices are entered in the database as prices INCL. TAX the calculation of custom prices goes wrong. Cart2Quote is in origin a business2business module and, unfortunatly, works in the core with prices EXCL. TAX. So all the custom prices entered for the quotations are considerd as prices EXCL. TAX.


Let's say a item costs €100,- excl. tax. If product prices are entered in the database EXCL. TAX (best practice), the calculation are right.

Subtotal (excl tax) = custom price     => €100,-

Tax                                                     =>  €21,-

Grand Total                                        => €121,-

For international webshops with different tax rules, this is the best setup. Tax is always calculated from the database price excl. tax.


When the prices are entered as prices INCL.TAX calculation of the custom prices goes wrong. Let's say with 21% tax the same product with a excl. price of €100,- will be entered as €121,- (including the €21,- tax).


Now the calculations go like this:

Subtotal (excl tax) = custom price     => €100,- (custom price entered as if price excl. tax.)

Tax                                                     => Magento config treats custom price €100,- as price INCL. TAX (that's the setting in the backend)

                                                           => Magento Tax calculation for custom price excl. tax €100/1.21 = 82,64 (THIS IS WHERE IT GOES WRONG!)

                                                           => Magento Tax => 21% * €82,64 = €17,36 (should be 21%!!)

Grand Total                                        => €117,36,- (should be €121,-)


Why enter database prices in prices EXCL TAX? The Magento store is based on the default country and currency setting. From this default settings, taxrules are applied for other tax regions. But what happens when the tax xhanges in the default country? All your product prices will be wrong!

If you have 19% tax (like in the Netherlands september 2012) the product above will be entered as a product price €119,- including tax. Magento calculates the price excl. tax from this database price. Product price excl tax will be €119/1.19 = €100,- as it should.

Now in october 2012 the tax changed to 21%. Product price excl. tax will be €119/1.21 = €98,35 and not €100,- as it should!! To correct this you will need to edit all your product prices!!

Therefore we strongly advise to ALWAYS enter product prices as prices EXCL TAX (and we based our module on this, unfortunatly) If tax rules change, edit the tax rule and ALL your prices will be correct!


So, if you know where it goes wrong why not change it? We cannot change the Magento Core tax calculation to calculate the right tax. This has to be done within our module. We are working on our module to correctly work with prices incl. or excl. tax. But this involves quote some work to fully implement this in our module.

For now the solution, and best practice, enter your product prices in the database as prices EXCL. TAX.

Have more questions? Submit a request


Please sign in to leave a comment.
Powered by Zendesk