We are having this problem too, and I believe it has only been happening in the last month, and possibly only since the last update. I can replicate the error by manipulating the URL to a product variation and alter the product attribute with one that doesn’t exist. For our needs (simple product feed), I don’t understand why the plugin is doing anything on product page load, but it is what it is.
Example error from the logs:
2022-03-17T00:31:34+00:00 CRITICAL Uncaught Error: Call to a member function get_price() on bool in /home/654.cloudwaysapps.com/ppjnrwjvc/public_html/wp-content/plugins/webappick-product-feed-for-woocommerce/includes/helper.php:5427
Stack trace:
#0 /home/654.cloudwaysapps.com/ppjnrwjvc/public_html/wp-includes/class-wp-hook.php(307): woo_feed_after_wc_product_structured_data()
#1 /home/654.cloudwaysapps.com/ppjnrwjvc/public_html/wp-includes/plugin.php(189): WP_Hook->apply_filters()
#2 /home/654.cloudwaysapps.com/ppjnrwjvc/public_html/wp-content/plugins/webappick-product-feed-for-woocommerce/includes/helper.php(3659): apply_filters()
#3 /home/654.cloudwaysapps.com/ppjnrwjvc/public_html/wp-includes/class-wp-hook.php(307): woo_feed_filter_woocommerce_structured_data_product()
#4 /home/654.cloudwaysapps.com/ppjnrwjvc/public_html/wp-includes/plugin.php(189): WP_Hook->apply_filters()
#5 /home/654.cloudwaysapps.com/ppjnrwjvc/public_html/wp-content/plugins/woocommerce/includes/class-wc-structured-data.php(328): apply_filters()
#6 /home/654.cloudwaysapps.com/ppjnrwjvc/public_html/wp-includes/class-wp-hook.php(307): WC_Structured_Data->generate_product_data()
#7 /home/654.cloudwaysapps.com/ppjnrwjvc/public_html/wp-includes/class-wp-hook.php(331): WP_Hook->apply_filters()
#8 /home/654.cloudwaysapps.com/ppjnrwjvc/public_html/wp-includes/plugin.php(474): WP_Hook->do_action()
#9 /home/654.cloudwaysapps.com/ppjnrwjvc/public_html/wp-content/themes/wass-theme-v3/woocommerce/content-single-product.php(90): do_action()
#10 /home/654.cloudwaysapps.com/ppjnrwjvc/public_html/wp-includes/template.php(772): require('/home/654.cl...')
#11 /home/654.cloudwaysapps.com/ppjnrwjvc/public_html/wp-content/plugins/woocommerce/includes/wc-core-functions.php(284): load_template()
#12 /home/654.cloudwaysapps.com/ppjnrwjvc/public_html/wp-content/themes/wass-theme-v3/woocommerce/single-product.php(39): wc_get_template_part()
#13 /home/654.cloudwaysapps.com/ppjnrwjvc/public_html/wp-includes/template-loader.php(106): include( in /home/654.cloudwaysapps.com/ppjnrwjvc/public_html/wp-content/plugins/webappick-product-feed-for-woocommerce/includes/helper.php on line 5427
In your helper.php’s woo_feed_after_wc_product_structured_data function, you have no error checking to ensure that the $variation_id array contains a valid variation ID, so when wc_get_product is called with null, $variation_product is not a variation product object, leading to this error.
Our specific problem is that we had a variation that changed attributes, so nothing is wrong with our variation, but Google still thinks the URL to that variation should exist. We could redirect to the new URL, but it seems the responsible thing for you to do to ensure that there are no fatal errors in this case.
-
This reply was modified 2 years, 8 months ago by skunkbad.