• Resolved Justin

    (@jtphelan)


    I’m receiving this error at checkout when a product price is $0 the cart total is $0.
    Uncaught DivisionByZeroError: Division by zero in /public_html/stage/wp-content/plugins/preorders-for-woocommerce-pro/src/Cart.php:52

    It appears it’s trying to divide a percentage by the cart total which happens to be 0.
    LINE 52:

    $porcentage = $total_discount_for_coupons / WC()->cart->get_subtotal(); //

    Changing it to this fixes the error for me.

    $porcentage = 0;
    if(WC()->cart->get_subtotal() > 0) {
    $porcentage = $total_discount_for_coupons / WC()->cart->get_subtotal(); //
    }
Viewing 1 replies (of 1 total)
  • Plugin Support mathdaniel

    (@mathdaniel)

    Hello,

    I hope you are well.

    First of all, thank you for the suggestion you provided. In this case, it is noted that you are using the premium version. We can send you an official patch to resolve this conflict you are experiencing.

    To ensure you receive the best possible assistance and access to official updates, we recommend contacting the official support channel. There, our team can assist you in more detail.

    Best regards,
    Peace

Viewing 1 replies (of 1 total)

The topic ‘Uncaught DivisionByZeroError: Division by zero’ is closed to new replies.