• Resolved evmapa

    (@evmapa)


    Hi! I just noticed the following problem. Here we have to calculate taxes not line by line but from the subtotal and only then round. I have checked the appropriate box in the woocommerce settings.

    However, I have just noticed that the shipping is still calculated separately and not as part of the subtotal. This leads to wrong rounding in many cases. E.g. the products cost 5.90 + 4.90 shipping. In this example all the products have the same tax class of 10% included so 10% applies to shipping too.

    5.90 + 4.90=10.80 / 11 = 0.9818… tax rounded to 0.98. This is how it’s supposed to be with calculating tax at the subtotal level.

    However, woocommerce does this:

    5.90 / 11 = 0.5363… rounded to 0.54
    4.90 / 11 = 0.4454… rounded to 0.45
    0.54 + 0.45 = 0.99 which is 0.01 too many.

    How can I fix this? Thanks!

Viewing 2 replies - 1 through 2 (of 2 total)
  • Plugin Support Hannah S.L.

    (@fernashes)

    Automattic Happiness Engineer

    Hey there!

    However, I have just noticed that the shipping is still calculated separately and not as part of the subtotal.

    That’s correct – we handle that separately as the subtotal is only for products purchased.

    0.5363 + 0.4454 = 0.9817

    Woo stores the tax rates to 4 decimal places to allow taxes and calculations to be reapplied to the true 4dp figure if needed. 0.9817 to 2 decimal places should indeed by 0.98 and not 0.99. The question is why it’s rounding incorrectly in this case.

    You mentioned that Round tax at subtotal level, instead of rounding per line is already enabled, which is the correct approach in this case.

    In regards to your other tax settings, how do you have Display prices in the shop and Display prices during cart and checkout set? Those also affect rounding, so I’d like to double check the exact setup.

    Plugin Support Hannah S.L.

    (@fernashes)

    Automattic Happiness Engineer

    We haven’t heard back from you in a while, so I’m going to mark this as resolved – if you have any further questions, you can start a new thread.

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Tax rounding wrong with shipping’ is closed to new replies.