Uncaught DivisionByZeroError: Division by zero
-
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:52It 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)
Viewing 1 replies (of 1 total)
The topic ‘Uncaught DivisionByZeroError: Division by zero’ is closed to new replies.