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

Commit

Permalink
Only set data is_rendering_php_template in Classic Themes on WooComme…
Browse files Browse the repository at this point in the history
…rce product archive templates where filters are being used. (#6324)
  • Loading branch information
tjcafferkey authored Apr 26, 2022
1 parent 9183017 commit 2d97d8b
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion src/Templates/ClassicTemplatesCompatibility.php
Original file line number Diff line number Diff line change
Expand Up @@ -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 );
}
}
}

0 comments on commit 2d97d8b

Please sign in to comment.