Critical Error in Admin Order View After Plugin Update
-
After updating to the latest version of WooCommerce Smart Coupons, we encountered a fatal error when viewing a WooCommerce order in the admin panel. The error stems from the plugin trying to call methods on a null $cart object.
Here’s the stack trace:
Fatal error: Uncaught Error: Call to a member function get_subtotal() on null in /plugins/woocommerce-smart-coupons/includes/class-wc-sc-display-coupons.php:1531
We reviewed the source and found the issue at around line 1531 in class-wc-sc-display-coupons.php. The relevant code looks like this:
$cart = is_object( WC() ) && isset( WC()->cart ) ? WC()->cart : null;
$subtotal = ( wc_prices_include_tax() && $cart->display_prices_including_tax() ) ? $cart->get_subtotal() + $cart->get_subtotal_tax() : $cart->get_subtotal();Thank you,
The topic ‘Critical Error in Admin Order View After Plugin Update’ is closed to new replies.