Luigi Teschio 2023-10-05 16:14:54 +02:00 committed by GitHub
parent 592db8df43
commit 74c6287485
3 changed files with 9 additions and 4 deletions

View File

@ -235,17 +235,18 @@ class ProductCollection extends AbstractBlock {
$is_product_collection_block = $parsed_block['attrs']['query']['isProductCollectionBlock'] ?? false;
if ( ! $is_product_collection_block ) {
return;
return $pre_render;
}
$this->parsed_block = $parsed_block;
$this->asset_data_registry->add( 'hasFilterableProducts', true, true );
/**
* It enables the page to refresh when a filter is applied, ensuring that the product collection block,
* which is a server-side rendered (SSR) block, retrieves the products that match the filters.
*/
$this->asset_data_registry->add( 'isRenderingPhpTemplate', true, true );
return $pre_render;
}
/**

View File

@ -170,7 +170,7 @@ class ProductQuery extends AbstractBlock {
*/
public function update_query( $pre_render, $parsed_block ) {
if ( 'core/query' !== $parsed_block['blockName'] ) {
return;
return $pre_render;
}
$this->parsed_block = $parsed_block;
@ -186,6 +186,8 @@ class ProductQuery extends AbstractBlock {
1
);
}
return $pre_render;
}
/**

View File

@ -68,7 +68,7 @@ class RelatedProducts extends AbstractBlock {
*/
public function update_query( $pre_render, $parsed_block ) {
if ( 'core/query' !== $parsed_block['blockName'] ) {
return;
return $pre_render;
}
$this->parsed_block = $parsed_block;
@ -82,6 +82,8 @@ class RelatedProducts extends AbstractBlock {
1
);
}
return $pre_render;
}
/**