Repository › Forums › Support › WooCommerce Extended Coupon Features PRO › single request to cart page generates 4 divide by zero on the same coupon › Reply To: single request to cart page generates 4 divide by zero on the same coupon
April 22, 2018 at 9:22 am
#3109
Jonathan Moore
Participant
Your logic sounds correct.
Nevertheless CHAR_LENGTH(meta_value) is zero length for the value in question using
select CHAR_LENGTH(meta_value) from wp_postmeta
where post_id = 15204
and meta_key = ‘minimum_amount’
Illogical as it might seem, I nevertheless resolved in my local environment with:
if ( $wrap_coupon->get_minimum_amount() ) {
if ($wrap_coupon->get_minimum_amount()==0){error_log('wjecf suppressing divide by zeron on coupon id' . $wrap_coupon->get_id() );} else {
$multiplier = self::min_value( floor( WC()->cart->subtotal / $wrap_coupon->get_minimum_amount() ), $multiplier );
}
}
and am getting the log message every time..