Support » Plugin: Crowdfunding for WooCommerce » Rounding error in “Orders Sum”

  • Resolved mrmartinimo

    (@mrmartinimo)


    Hi all,

    I have noticed that a small rounding error occurs when the item price (excluded taxes) is added with the taxes. By then adding up the individual item prices with the error, this error gets bigger and bigger.

    For example, if I have an item price of $20 including 7% taxes, then the following calculation is made:

    Item price: 18,691589$
    Tax: 1,31$
    Sum: 20,001589$

    If we add this up 10 times, we will not have 200,00$ but 200,01589$ => 200,02$ in the end.

    The problem can be fixed quite easily by rounding the single item price once before adding it up.

    This happens in the wc-crowdfunding-functions.php file on line 213:
    $sum = $item['line_total'] + $item['line_tax'];

    This line could be replaced by the following code:
    $sum = round( $item['line_total'] + $item['line_tax'], 2, PHP_ROUND_HALF_UP );

    Perhaps you could consider this for the next release.

    Tank you. 🙂

Viewing 1 replies (of 1 total)
  • Plugin Support MeganSupport

    (@megan891)

    Hi @mrmartinimo

    Please refer to this link https://wordpress.org/support/topic/need-help-read-this-first-13/ on how to go about getting assistance from our support team.

    We stand behind Crowdfunding for WooCommerce 100%. If you experience any issues we will be happy to help you via our official website only. We do NOT monitor this forum for support requests.

    If you need help, a good place to start is our documentation.

    If you can’t find the answer there, simply open a support ticket on our website.

    Thanks!

Viewing 1 replies (of 1 total)
  • You must be logged in to reply to this topic.