Disable client-side nav in PC block when filters are inside (#51358)

* Disable client-side nav in PC block when filters are inside

* Add changelog

* Fix lint
This commit is contained in:
Karol Manijak 2024-09-13 09:58:17 +02:00 committed by GitHub
parent 9d76114472
commit 29ed02836a
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 16 additions and 5 deletions

View File

@ -0,0 +1,4 @@
Significance: patch
Type: update
Product Collection: Disable client-side nav if filter blocks are detected inside

View File

@ -499,11 +499,18 @@ class ProductCollection extends AbstractBlock {
*/ */
private function is_block_compatible( $block_name ) { private function is_block_compatible( $block_name ) {
// Check for explicitly unsupported blocks. // Check for explicitly unsupported blocks.
if ( $unsupported_blocks = array(
'core/post-content' === $block_name || 'core/post-content',
'woocommerce/mini-cart' === $block_name || 'woocommerce/mini-cart',
'woocommerce/featured-product' === $block_name 'woocommerce/featured-product',
) { 'woocommerce/active-filters',
'woocommerce/price-filter',
'woocommerce/stock-filter',
'woocommerce/attribute-filter',
'woocommerce/rating-filter',
);
if ( in_array( $block_name, $unsupported_blocks, true ) ) {
return false; return false;
} }