• Hi, Our site is down due to a fatal error which seems to have something to do with the YITH WooCommerce Product Add-ons & Extra Options plugin. The error reads:

    Fatal error: Uncaught Error: Call to a member function get_price() on bool in /home/customer/www/lifesapitchkent.co.uk/public_html/wp-content/plugins/woocommerce/includes/wc-product-functions.php:1126 Stack trace: #0 /home/customer/www/lifesapitchkent.co.uk/public_html/wp-content/plugins/yith-woocommerce-product-add-ons/plugin-fw/yit-woocommerce-compatibility.php(572): wc_get_price_to_display(false, Array) #1 /home/customer/www/lifesapitchkent.co.uk/public_html/wp-content/plugins/yith-woocommerce-product-add-ons/includes/class-yith-wapo-cart.php(222): yit_get_display_price(false) #2 /home/customer/www/lifesapitchkent.co.uk/public_html/wp-content/plugins/yith-woocommerce-product-add-ons/includes/class-yith-wapo-cart.php(125): YITH_WAPO_Cart->add_cart_item(Array) #3 /home/customer/www/lifesapitchkent.co.uk/public_html/wp-includes/class-wp-hook.php(310): YITH_WAPO_Cart->get_cart_item_from_session(Array, Array) #4 /home/customer/www/lifesapitchkent.co.uk/public_html/wp-includes/plugin.php(205): WP_Hook->apply_filters(Array, A in /home/customer/www/lifesapitchkent.co.uk/public_html/wp-content/plugins/woocommerce/includes/wc-product-functions.php on line 1126

    There has been a critical error on this website.

    Hoe do I solve this please?

    Thanks From Toby

    The page I need help with: [log in to see the link]

Viewing 4 replies - 1 through 4 (of 4 total)
  • Hello, I fixed the bug. The error comes from the file /yith-woocommerce-product-add-ons/includes/class-yith-wapo-cart.php on line 217:

    $_product  = isset( $cart_item['variation_id'] ) ? wc_get_product( $cart_item['variation_id'] ) : wc_get_product( $cart_item['product_id'] );

    change to:

    $_product  = isset( $cart_item['variation_id'] ) && $cart_item['variation_id'] != 0 ? wc_get_product( $cart_item['variation_id'] ) : wc_get_product( $cart_item['product_id'] );

    The variant ID is (INT)0 and cannot find the product.

    Same problem here, the solution by @waroberterdmann works for me.

    @waroberterdmann Thanks for awesome help. i spent 1+ hours to investigate by deactivation other plugins but finally thought to plugin support and your small code saved me. thanks again

    Plugin Support Giuseppe Madaudo

    (@askmagic)

    Hi everyone and thank you to @waroberterdmann.

    We just released a new version of the plugin in order to solve this issue.

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘Fatal Error’ is closed to new replies.