**UPDATED TO CRITICAL BUG - AS OF 3-26-09: Magento according to Client is not accurately calculating tax and not compliant with tax law
This is affecting currently all versions of Magento (1.0 thru 1.2.x)
I think this hasn’t gotten much attention because its somewhat hard to understand and many online store owners aren’t familiar with how traditional cash register’s / tax calculation works. .. Let me clarify this bug which again applies to all versions of Magento:
Bottomline:
WHAT IS HAPPENING NOW: Magento is taxing products individually, rounding the tax and then adding the tax and making it the Total Tax
Total tax is the sum total of all the rounded taxes.. BUT rounding shouldn’t happen per item
IT SHOULD BE: Calculating tax based on the subtotal (of taxable products), then rounding the total tax and adding that to the grand total
[[ Begin Taxable good items ]]
Item Price
Item Price
Item Price
Item Price
Item Price
[[End Taxable good items
* Tax Rate
= rounded(Total Tax for the Order)
SO HOW DOES IT AFFECT MY STORE?: Result is your customers are being charged more/less tax than they should be charged.
OTHER RELATED ISSUES: This is also what is happening with discounts.. stay tuned for another post on this.. but it appears this issue is related to how discounts are being calculated.
A client of ours has noticed that Magento may have an issue with the way that it is calculating SALES TAX and although the miscalculation is only a difference of a couple pennies, their bookkeeper says it would be alarming to the State Board of Equalization and could result in many headaches. They have an online store, powered by Magento, as well as a physical retail store located in California.
Roy/Yoav any confirmation of this? Will 1.3 have a fix? If not, is anyone interested in working with our dev team to fix this critical bug as it affects ALL Magento stores
********************************************
This one I’m going to have to ask the census here because I am no sales tax expert but I do know there is a realistic and possible major discrepancy. Unlike other Clients she actually has a popular physical location in the greater Los Angeles area. So, she compared the receipt from a “test” instore purchase to a test purchase her Magento instance and came up with different numbers . Both are configured with the same tax rate but applied in different ways…
So here is the issue… Magento appears to be calculating sales tax the following way according to 1.1.6 and previous versions
Subtotal $125.35 * .0825 Tax Rate (8.25%)
Tax Total $10.34
Tax method 1 - $10.36 vs Tax Method 2 - $10.34
You’ll notice the different tax totals .. Yes they appear to be a few pennies different per method but could make a huge difference for store processing lots of orders.. They might find either they are collecting excess tax dollars or less sale tax revenue.
From what I know and what people have told me the traditional method is what most people use… It appears Zen cart also has this bug and people have mentioned this..
I think the solution for Magento would be to remove the rounding function for each items tax calculation and just apply rounding at the end
because
(X+X +X+X) * Y = Z
but ...
(rounded X + rounded X + rounded X + rounded X )* Y does not always equal the Z from the equation above.. and if a company is placing lots of orders it could add up to alot of + or - when it comes to sales tax.. the last thing you want to have happen is you owe your State tax board $$$$$$$ of non-collected sales tax due to a flaw…
Any one else notice this? Is tax supposed to be calculated like the Magento method (per item rounded) ? Does our Client have an incorrectly configured cash register?
To answer your question first. Your client is correct, you should not round sub-totals always round the total number. Why? Well you showed that part This is basic math actually (no offense) and has nothing to do with sales tax, although governments can make it difficult, this not one of those things.
However this leads to the conclusion that there must be a flaw in the Magento system on this point. I know there are several Issues reported and those are assigned. My guess is it has everything to do with the rounding out or rounding out and not passing along enough digits.
In order to make that clear I have made a small table using your values.
125.35000 10.34138 10.36 10.343 10.3416 10.34139 SUM
Hopefully this comes across. If it is a bit messed up, look at the last row (SUM). The first amount is the Total order and the second amount is the total tax calculated from the Total order. The others are Sums from the x-digits formats.
As you can see only the 5-digit sum gets the closed to the tax calculated from the total order.
The solution is simple. Pass along all values with 5-digits. You could also do it with four, that is the minimum, but then you still will have differences from time to time. With five it is almost not existent.
If this is easy to implement is a second
Hello, i have the same problem. I am using Magento 1.1.7.
Is there a fix by now?
Furthermore i have the following curios case:
I’ve created a product with the price 2,86 € (excl. tax). The product-price is announced in the frontend incl. tax (19%). So far so good. But if i choosed two articles of the same product, the cart shows me instead 3,40 € the wrong price 3,41 €. This appears only when i choose two articles.
Have this the same reason (round-function) like above?
I believe we are close to fixing this… Gui i made a new rounding function in /app/code/core/Mage/Core/Model/Store.php and changed the way tax is being rounded (per item) in app/code/core/Mage/Sales/Model/Quote/Item/Abstract.php but we are testing it in a real scenario on our dev site.. I’ll let you know our results shortly..
@bytestorm
Good to hear. Not before 2.0 I presume?
@dakman
I do believe that is a good start solution but I think the problem runs much deeper. However I am looking forward to see what you come up with.
Are there any developments on this issue. I only noticed it when I set up a test product with a value of £0.01. When you purchase a quantity of this item the tax is still calculated on at an individual level so no tax gets added to the row.
Been sooo swamped havent had a chance to dive into this. This has been on my mind lately and I want to get around to fixing it but I really need the community/magento’s help on this one.. This is a complicated fix because it doesnt just effect the way taxes are calculated but discounts as well.. but YES THIS IS a critical issue..
I have upgraded from 1.2 to 1.2.1.1 with the diff files. I can confirm that it doesn’t correct my problem.
When ordering two of the same products the rounding with tax is gives me trouble with the iDEAL payment that the total amount is not correct. (one cent short)