[ad_1]
Replies: 4
Today I was debugging Cartflow setting page not loading. It was caused by:
/wp-json/cartflows/v1/admin/commonsettings/?_locale=usereturn 500 error
Fatal error: Uncaught Error: Call to a member function get_cart_contents_count() on null in /home/xxx/public_html/wp-content/plugins/woo-auto-coupons/wac_functions.php:139Change line 139 from
$cart_qty=$woocommerce->cart->get_cart_contents_count();to
if ( is_object($woocommerce->cart) ) { $cart_qty=$woocommerce->cart->get_cart_contents_count(); } else {}fixed the problem but the json format is still not right because
<br />
<b>Warning</b>: Invalid argument supplied for foreach() in <b>/home/xxx/public_html/wp-content/plugins/woo-auto-coupons/wac_functions.php</b> on line <b>186</b><br />Change line 186 from
foreach($cart->cart_contents as $cart_item_key=>$cart_item) $cart_items++;to
foreach((array)$cart->cart_contents as $cart_item_key=>$cart_item) $cart_items++;I have checked $cart->cart_contents with is_array and is _object, it’s valid, I don’t know why PHP throw out this waring.
Hope this helps somebody who has encountered the same issue.
