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$
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. 🙂
- You must be logged in to reply to this topic.