Undefined property: stdClass::$line_total
-
Since yesterday, I’ve been getting this error message:
PHP Warning: Undefined property: stdClass::$line_total in /httpdocs/wp-content/plugins/woocommerce-abandoned-cart/cron/class-wcal-cron.php on line 544According to AI:
In
wcal_check_cart_total()the code loops through the cart items and reads$v->line_totalfor each item. Some cart items in the database (often old or incomplete abandoned carts, for example cart items that have been saved without complete WooCommerce data, or an empty/corrupted item) do not have aline_totalproperty. PHP then issues a warning because you are attempting to read a non-existent property. The script does not crash as a result (the warning is not fatal), but it clutters up your logs considerably if this happens on every cron run.The fix: Add an
isset()check so that the warning no longer occurs.
You must be logged in to reply to this topic.