Skip to content
This repository was archived by the owner on Feb 23, 2024. It is now read-only.

Commit 13036f3

Browse files
tjcafferkeyTarun Vijwani
authored andcommitted
Only set data is_rendering_php_template in Classic Themes on WooCommerce product archive templates where filters are being used. (#6324)
1 parent 2da9079 commit 13036f3

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

src/Templates/ClassicTemplatesCompatibility.php

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,9 +64,14 @@ public function set_filterable_product_data() {
6464
* This method passes the value `is_rendering_php_template` to the front-end of Classic themes,
6565
* so that widget product filter blocks are aware of how to filter the products.
6666
*
67+
* This data only matters on WooCommerce product archive pages.
68+
* On non-archive pages the merchant could be using the All Products block which is not a PHP template.
69+
*
6770
* @return void
6871
*/
6972
public function set_php_template_data() {
70-
$this->asset_data_registry->add( 'is_rendering_php_template', true, null );
73+
if ( is_shop() || is_product_taxonomy() ) {
74+
$this->asset_data_registry->add( 'is_rendering_php_template', true, null );
75+
}
7176
}
7277
}

0 commit comments

Comments
 (0)