Featured block says critical error
-
Hello,
When I try to add a featured product block, I get a spinning wheel for a few seconds and then immediately, this message:The following error was returned
<p>There has been a critical error on this website.</p><p>Learn more about troubleshooting WordPress.</p>See screenshot: https://cloudup.com/c3CJBfTpZ5S
I deactivated all plugins except woocommerce and woocommerce blocks, same issue hapens.
Works with Twenty Twenty One theme. What does my theme need to support this feature? Using Genesis as the parent with a child theme.
Debug log has this as the latest error when I try to do this (not sure if it’s related):
[06-Jun-2021 00:19:49 UTC] PHP Fatal error: Uncaught Error: Call to a member function is_type() on null in /nas/content/live/*installname*/wp-content/themes/*child-theme-name*/functions.php:421 Stack trace: #0 /nas/content/live/*installname*/wp-includes/class-wp-hook.php(294): {closure}('Add to cart') #1 /nas/content/live/*installname*/wp-includes/plugin.php(212): WP_Hook->apply_filters('Add to cart', Array) #2 /nas/content/live/*installname*/wp-content/plugins/woocommerce/includes/class-wc-product-simple.php(62): apply_filters('woocommerce_pro...', 'Add to cart', Object(WC_Product_Simple)) #3 /nas/content/live/*installname*/wp-content/plugins/woo-gutenberg-products-block/src/StoreApi/Schemas/ProductSchema.php(460): WC_Product_Simple->add_to_cart_text() #4 /nas/content/live/*installname*/wp-content/plugins/woo-gutenberg-products-block/src/StoreApi/Routes/Products.php(56): Automattic\WooCommerce\Blocks\StoreApi\Schemas\ProductSchema->get_item_response(Object(WC_Product_Simple)) #5 /nas/content/live/*installname*/wp-content/plugins/woo-gutenberg-products-block/src/StoreApi in /nas/content/live/*installname*/wp-content/themes/*child-theme-name*/functions.php on line 421 [06-Jun-2021 00:20:16 UTC] auditor:event=switch_theme {"new_name":"Twenty Twenty-One","blog_id":1,"event":"switch_theme","current_user_id":2,"remote_addr":"*000.000.000.00*"}
This is what is on lines 418 – 425 in functions.php (per the line 421 referenced above):
/*Change Select Options Text */ add_filter( 'woocommerce_product_add_to_cart_text', function( $text ) { global $product; if ( $product->is_type( 'variable' ) ) { $text = $product->is_purchasable() ? __( 'Options', 'woocommerce' ) : __( 'Read more', 'woocommerce' ); } return $text; }, 10 );
WP Core 5.7.2
PHP 7.4
All themes and plugins are up to date
On a WP Engine dev environmentThank you
- The topic ‘Featured block says critical error’ is closed to new replies.