Reputation: 12598
I have an item in my WooCommerce shop that costs 24.17 exclusive of Tax. I have a tax rate setup of 20%.
If I add 3 of these products to my cart then it gives me a total including Tax of £87.01 when I would expect to get £87.
24.17 plus 20% is £29.004, why is it not rounding this down to £29.00?
Upvotes: 2
Views: 3739
Reputation: 3899
When WooCommerce calculates the tax it first multiples the price without tax by the quantity being ordered. So as far as WooCommerce is concerned, the price to apply tax to is £72.51. It adds 20% to this value. You then get £87.012. It is this final number which is rounded down to £87.01.
To show that mathematically:
24.17 x 3 x (1 + 0.2)
= 87.012
.
If you want WooCommerce to change the way it calculates that tax you'll have to add the code to your functions.php
file. It might look a little like the following:
add_filter( 'woocommerce_get_price_excluding_tax', 'custom_edit_price_function',10,3);
function custom_edit_price_function($price, $qty, $product) {
//calculate price how you like it here.
return $price;
}
Upvotes: 1