Fatal error: Uncaught Error: Call to undefined function is_product()
-
Hi,
I am using this plugin for quite a long time and it was working fine until I tried to install “WooCommerce Boost Sales – Upsells & Cross Sells Popups & Discount” plugin with below error and staktrace.
[31-Oct-2019 03:20:12 UTC] PHP Fatal error: Uncaught Error: Call to undefined function is_product() in /public_html/wp-content/plugins/back-in-stock-notifier-for-woocommerce/includes/frontend/class-product.php:186 Stack trace: #0 /public_html/wp-includes/class-wp-hook.php(288): CWG_Instock_Notifier_Product->display_out_of_stock_products_in_variable('no') #1 /public_html/wp-includes/plugin.php(208): WP_Hook->apply_filters('no', Array) #2 /public_html/wp-includes/option.php(152): apply_filters('option_woocomme...', 'no', 'woocommerce_hid...') #3 /public_html/wp-content/plugins/woocommerce-boost-sales/frontend/bundles.php(54): get_option('woocommerce_hid...') #4 /public_html/wp-content/plugins/woocommerce-boost-sales/includes/functions.php(34): VI_WBOOSTSALES_Frontend_Bundles->__construct() #5 /public_html/wp-content/plugins/woocommerce-boost-sales/includes/define.php(63): vi_include_folder('/mnt/data/home/...', 'VI_W in /public_html/wp-content/plugins/back-in-stock-notifier-for-woocommerce/includes/frontend/class-product.php on line 186
I updated the plugin to its latest version which also couldn’t help. Then I went to below file and fixed the issue by adding a check if woocommerce is loaded and fix the issue.
File: /plugins/back-in-stock-notifier-for-woocommerce/includes/frontend/class-product.php
Function: display_out_of_stock_products_in_variable
Line Added: if (!class_exists(‘WooCommerce’)) return $value;
Before Line: if (is_product() && $ignore_wc_visibility) {
This solution has fixed the issue. Please update it with plugin’s next version release.
- The topic ‘Fatal error: Uncaught Error: Call to undefined function is_product()’ is closed to new replies.