PHP Notice: Trying to get property of non-object
-
I’m sporadically getting this entry in the logs:
PHP Notice: Trying to get property of non-object in \plugins\wc-abandoned-carts-by-small-fish-analytics\class-sfa-abandoned-carts-recorder.php on line 96
The offending part happens in this check:
//Don't create a record unless a user is logging in with something in their cart if (!$woocommerce->cart->cart_contents) { return; }
Not sure why’s this happening to propose a fix. Of course we could use a slightly different syntax like
if ( WC()->cart->get_cart_contents_count() == 0 )
but this is just masking the issue, as an empty cart should be handled gracefully anyway. Please advise.
Viewing 7 replies - 1 through 7 (of 7 total)
Viewing 7 replies - 1 through 7 (of 7 total)
- The topic ‘PHP Notice: Trying to get property of non-object’ is closed to new replies.