Cart line total is a bit off (0.01 or more) - why?


Sometimes you can setup the rule, which may be displayed a bit incorrectly in cart. Most probably it is related to prices rounding performed by WooCommerce: it's required to have per item price to be the same and with some rules this price might end up having a lot of decimal numbers (or even infinite). You may try to increase number of decimals in prices to improve the accuracy of such numbers, but that may not always help.

Here's some examples explaining how this might happen (all from real rules created by our customers):

  1. You setup the rule "2 for 6.99", then price per item is counted: 6.99/2 = 3.495. If you have 2 decimal numbers, then 3.495 will be rounded up to 3.50, and the total will become 7.00 instead of 6.99.

  2. You create the rule "3 for 8.00". In that case we have infinite decimal numbers as a result: 8/3 = 2.6(6), so when rounded with setting of 2 decimal numbers in price, the total will be 2.67*3 = 8.01, but with 3 decimal numbers it will be 2.667*3 = 8.001, which may be treated as 8.00.

  3. You have tiered pricing rule "1 for 500 and 2-18 for 400". If you put 19 products in cart: 1 item will be for 500, and 18 - for 400, so total should be 7700. But WooCommerce needs price per item to be the same, so the calculation is made:
    7700 / 19 = 405,2631578...
    Which as you can see then rounded to 405.26, which is then multiplied to 19 and the total gets quite off to 7699,94.

If you experience similar issue, but nothing changes after you change the decimal number setting, then this might be caused by something else - don't hesitate to submit a support ticket to us, so we could check your setup.

 

Have more questions? Submit a request