Support » Plugin: WooCommerce Bulk Discount » Rounding error on percentage discount

  • davepremo


    I am using the percentage discount as I want to provide a discounted price per item on quantity orders. The issue I’m having is I upload and calculate the percentage from the item price a the quantity level from another plugin. For example,

    Item Price: 14.25
    Qty 4: 13.75 (calculated discount = 3.5087719298246)
    Qty 20: 13.25 (calculated discount = 7.0175438596491)

    What is happening is when the customer buys 20 pieces, the price I’m expecting is:
    20 * 13.25 = 265.00 (That is the price that is listed on the discount table)
    But the plugin is generating a price of:
    20 * 14.25 * (1-0.072) = 264.99 for that line item.

    So it appears that you are rounding the discount to 2 decimal places and then calculating the discount. If you used 4 decimal places for the calculation, the proper value would be calculated.

    Can you please increase the precision (rounded to 4 decimal places) in the next release?

Viewing 1 replies (of 1 total)
  • Plugin Author renp


    You can use Fixed discount instead and set Qty 20: 1.
    Then the plugin will calculate 20*13.25 = 265.00.

Viewing 1 replies (of 1 total)
  • The topic ‘Rounding error on percentage discount’ is closed to new replies.