CoreCommerce Sales Tax Calculation Wrong

Permalink 1 user found helpful

I may be going mad, but I think the Sale Tax calculation may be incorrect on CoreCommerce where you select Sales Tax is included in price.

For example a product costing £170 with a sales tax of 15% included, and a £5.95 delivery charge should cost £175.95 of which £22.95 is the sales tax element.

Instead CoreCommerce is calculating £25.50 sales tax.

Does anyone know where this calculation is performed, or if I am incorrect about my calculations.

Many Thanks

View Replies:
tbcrowe replied on at Permalink Reply
In the US sales tax is typically added onto the sales prices. It usually does not include shipping. Given that 25.50 would be the correct amount.
openbynature replied on at Permalink Reply
many thanks for the reply, I assumed when I clicked sales tax included in price it would calculate it that way.

Can you tell me where the calculation is in the code so I can customize this?
andrew replied on at Permalink Reply
It _should_ be calculated that way. I think we do have a bug here. We'll look into it.

The idea behind that "include in price" box is specifically for situations like VAT, where someone wants to know how much of the order is sales tax - but it has already been included in the price, not added on afterwards.
openbynature replied on at Permalink Reply
Thanks Andrew, also I am just looking into the shipping side, this should also show VAT included.

I have made a quick fix to the code to keep me going, basically in the file models/sales/tax/rate.php, but am just testing to see if it works now or whether I missed anywhere else.

openbynature replied on at Permalink Reply
Quick update, so that's working if you always sell using VAT included, the line of code I put in place is

$amount += round($product->getProductCartQuantizedPrice() - (((100 / ($rate->getSalesTaxRateAmount() + 100)) * $product->getProductCartQuantizedPrice())), 2);

instead of

$amount += round(($rate->getSalesTaxRateAmount() / 100) * $product->getProductCartQuantizedPrice(), 2);

However the shipping element does not get included in the tax so far. Can you tell me where I could add this sort of code so that cost of shipping is included?
rmdesign replied on at Permalink Reply
2 years on and looks like this hasn't been migrated back in to the core code. Disappointing
ryan replied on at Permalink Reply
@rmdesign Your post here brought this one back onto our radar. We typically don't monitor the chit chat forum too closely for ecommerce issues.

In any case it absolutely makes sense that the amount of tax displayed shouldn't be calculated as the tax percentage of the product's price including tax, but excluding the tax. I still have some questions as to how tax on shipping would even work with this.

I'll get a solution included in the next release.