From fe8945fc598e7b835b6526c5597b5d94065a6de5 Mon Sep 17 00:00:00 2001 From: tjcafferkey Date: Tue, 26 Apr 2022 11:59:25 +0100 Subject: [PATCH] Only set data is_rendering_php_template in Classic Themes on WooCommerce product archive templates where filters are being used. --- src/Templates/ClassicTemplatesCompatibility.php | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/Templates/ClassicTemplatesCompatibility.php b/src/Templates/ClassicTemplatesCompatibility.php index a42e58149b3..dc27d796f1c 100644 --- a/src/Templates/ClassicTemplatesCompatibility.php +++ b/src/Templates/ClassicTemplatesCompatibility.php @@ -64,9 +64,14 @@ public function set_filterable_product_data() { * This method passes the value `is_rendering_php_template` to the front-end of Classic themes, * so that widget product filter blocks are aware of how to filter the products. * + * This data only matters on WooCommerce product archive pages. + * On non-archive pages the merchant could be using the All Products block which is not a PHP template. + * * @return void */ public function set_php_template_data() { - $this->asset_data_registry->add( 'is_rendering_php_template', true, null ); + if ( is_shop() || is_product_taxonomy() ) { + $this->asset_data_registry->add( 'is_rendering_php_template', true, null ); + } } }