CoreCommerce Sales Tax Calculation Wrong1 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.
Can you tell me where the calculation is in the code so I can customize this?
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.
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.
$amount += round($product->getProductCartQuantizedPrice() - (((100 / ($rate->getSalesTaxRateAmount() + 100)) * $product->getProductCartQuantizedPrice())), 2);
$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?
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.