• Resolved aganis

    (@aganis)


    I find the problem of rounding discount in %

    This is an example:
    I set price with 2 decimal: 18,50 €
    I create and apply a coupon with 5% discount

    The result is: 18,50 – 5% = 17,58

    But is not corrent because 5% of 18,50 is 0,925 -> and correct roundins is 0,93
    The correct result is: 18,50 – 5% = 17,57

    How is it resolved?

Viewing 7 replies - 1 through 7 (of 7 total)
  • Plugin Support abwaita a11n

    (@abwaita)

    Hi @aganis,

    Just to mention, calculations in WooCommerce are done in 4dp then the results are rounded off.

    Thus, in your case:
    18.50 – (0.05*18.50) = 17.575
    Once rounded to 2dp, it becomes 17.58.

    Hope this clarifies.
    Thanks.

    Plugin Support abwaita a11n

    (@abwaita)

    Hi,
    We’ve not heard back from you in a while, so I’m marking this thread as resolved. Hopefully, the above info was helpful.

    If you have further questions, please feel free to open a new topic.

    Thanks.

    Thread Starter aganis

    (@aganis)

    is it not possible to change the type of calculation according to the tax fund system?

    Plugin Support abwaita a11n

    (@abwaita)

    Hi @aganis,

    Not quite sure I fully got your question. To get better context, could you kindly clarify the question a little bit, especially the “tax fund system” part?

    Thanks.

    Thread Starter aganis

    (@aganis)

    I apologize,
    I wanted to ask if it is possible to change the discount calculation system because the cach desk calculates the discount in a different way and therefore the total counts are different at this time.

    Hey @aganis,

    I wanted to ask if it is possible to change the discount calculation system because the cach desk calculates the discount in a different way and therefore the total counts are different at this time.

    I’m afraid there’s no easy way to change how WooCommerce calculates those discounts. You would need some custom code to change how the calculation is done.

    I had a look online and I wasn’t able to find any snippets that could help with this. I’m going to leave this topic open for a bit to see if anyone is able to chime in to help you out.

    You can also visit the WooCommerce Facebook group or the #developers channel of the WooCommerce Community Slack. We’re lucky to have a great community of open-source developers for WooCommerce, and many of our developers hang out there, as well.

    I hope that helps!

    Kind regards,

    Thread Starter aganis

    (@aganis)

    thanks

Viewing 7 replies - 1 through 7 (of 7 total)
  • The topic ‘Discount rounding’ is closed to new replies.