I know this is a common issue, but cant seem to find a proper answer anywhere.
I am running a Magento 2.3.3 shop and have my product imported through a plugin and these are imported excluding tax (i cannot change this, my industry suppliers work on excluding tax and this is how the prices are imported).
No matter what tax settings i use the inc VAT prices are always wrong when added to the cart.
For example, i have a product that sells for £8 inc VAT, so the ex VAT price set in the catalog is £6.67. The catalog and product pages display this correct at £8, but when a quantity of 2 is added to that cart it shows at £8.01 each.
I had an order yesterday for:
2 x £8
2 x 17 (these show as £17.01 in the cart)
£5 delivery

Magento works this out at £55.02, not £55. Before tax it displays as £45.85, not £45.83 like it should be.

No customers have yet questioned it, but it is frustrating and only a matter of time until somebody does.

My current tax settings are:
Tax Calculation Method Based On: Total (Have tried unit and row and i would prefer unit)
Catalog Prices: Excluding Tax (has to be this way)
Shipping Prices: Excluding Tax

Discounts are a whole other ball game and dont seem to be ale to do calculate discount after and including tax but this is not my worry for now.

I would like to figure out how i can display, in this example the prices correct with a total of £55 inc VAT. I know this is a rounding issue but dont know how to solve it.


  • I am curious about this part. All prices are imported at 2 decimal places. What if you want a SKU 3.99 inc VAT? Commented Oct 18, 2020 at 9:10

1 Answer 1


The problem comes from that Magento internally works with 4 decimals.

And depending which calculation algoritm you select in backend it calculates the quote_item price_incl_tax differently. E.g. when you have Tax Calculation Method Based On = Total or Row total

6.67*1.20 = 8.004 => 8.00 on the product pages it becomes correct but beneath the price it calculates with is 8.004. So your product prices are in fact 8.004, and it will use that decimal in calculations until it is rounded.

So when you have qty=2,*2 = 16.008 = 16.01. Then 16.01/2 = 8.005 => 8.01 each.

One can also see this when observing the quote_item table.

I set up a tax rate with 20% tax and created a product that costed 6.67. I could reproduce the issue you are having with Tax Calculation Method Based On = Total: enter image description here

However, when I change to Tax Calculation Method Based On = Unit price. It calculates the prices correctly, also when observing the quote_item table:

enter image description here

This makes sense as it round the unit price and inserts it to the quote_item table when the quote is saved so it never get the extra third decimal. Are you sure you are still having the issue when you are using Tax Calculation Method Based On Unit price?

  • I believe that parts of Magento force you to work with 2DP github.com/magento/community-features/issues/210 it's been a while since I've tested this but it's something I've learnt to either live with or override if client raises concern Commented Oct 18, 2020 at 9:15
  • Thanks for your explanation, it makes sense. I am currently using the tax calculation based on unit price and have the same issue, a quantity of 2 the total is £16.01 and the unit price changes to £8.01 so it is not observing the same as your installation is. Maybe this is a UK GBP currency vs USD issue? I know this has been an issue for a long time, but we shouldnt have to live with it! The plugins i have seen to sort this have not been updated in years so i dont want to risk them not working on my install. I cant believe such a widely used platform like Magento doesnt have a solution
    – Alex Smith
    Commented Oct 19, 2020 at 8:50
  • Hello Alex, what about writing a Magento plugin to the plugin you are using for importing products and apply taxes before you set the prices? This might be the cleanest way to solve the issue, and most likely it is very little code needed.
    – Kristoffer
    Commented Oct 19, 2020 at 8:58
  • This may be possible if i knew how! I guess that way i could apply discounts correctly too as for the UK magento suggest using catalog including tax. Do you have any ideas where to start to make these changes or would it be a case of looking through the plugin code to find out where it does the price importing?
    – Alex Smith
    Commented Oct 19, 2020 at 12:25
  • To give further info, the plugin works by adding all my products, prices etc into various tables in the database and then to wherever magento stores this value. I did not develop this plugin, but it is a plugin that stores products and prices from my various suppliers and allows me to import this information and it updates daily
    – Alex Smith
    Commented Oct 19, 2020 at 12:36

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.