• Resolved orostegui

    (@orostegui)


    I have found an error in the file src/Integration/WooCommerce.php on line 816

    $discount = $discount / $item['quantity'] 

    I have solved it simply by adding the validation if the discount is 0 do not do the division

    if ($discount > 0) {
    $discount = $discount / $item['quantity'];
    }
    • This topic was modified 4 days, 16 hours ago by orostegui.
Viewing 2 replies - 1 through 2 (of 2 total)
  • Plugin Author Torben Lundsgaard

    (@torbenlundsgaard)

    That does not make sense. The only way that you can have division by zero is if $item[‘quantity’] is zero. I’m not sure what the cause is when quantity is zero but i have the following check to prevent it in any case:

    if ( isset( $item['quantity'] ) && $item['quantity'] > 0 ) {
    $discount = $discount / $item['quantity'];
    } else {
    $discount = 0;
    }

    It will be included in the next release

    Plugin Author Torben Lundsgaard

    (@torbenlundsgaard)

    The fix has been merged and will included in a release tomorrow. Thank you for bring this to my attention!

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