• Plugin crashes when you have a deleted product in cart

    PHP Fatal error: Uncaught Error: Call to a member function get_stock_quantity() on bool in wp-content/plugins/wc-smart-cod-pro/public/class-wc-smart-cod-public.php:1500

    The fix would be to check wc_get_product if exists:

            foreach ( $cart_products as $product ) {
                $_product = wc_get_product( $product );
                $qty = !$_product ? 0 : $_product->get_stock_quantity();
                $stock    = $qty;
  • The topic ‘get_stock_quantity fails on products that are not valid’ is closed to new replies.