Skip to content

Commit 32c0ed0

Browse files
anaemnesismatticbot
authored andcommitted
Instant Search: Enable WooCommerce Product Attribute Filters (#46373)
* Remove WC Product Filter Restriction This removes the restriction on showing the WooCommerce Product Filter as an Instant Search filter option. * changelog Committed via a GitHub action: https://github.com/Automattic/jetpack/actions/runs/20961435638 Upstream-Ref: Automattic/jetpack@11fe014
1 parent 4a0b5ed commit 32c0ed0

File tree

7 files changed

+150
-153
lines changed

7 files changed

+150
-153
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ This is an alpha version! The changes listed here are not final.
88

99
### Enhancements
1010
- Forms: make form webhooks generally available.
11+
- Instant Search: Show WooCommerce product filters in filter widget
1112

1213
### Bug fixes
1314
- Slideshow: Ensure slideshows do not stretch to parent container width on mobile if no list height is set.

jetpack_vendor/automattic/jetpack-search/CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ This is an alpha version! The changes listed here are not final.
1313
- Instant Search: Add a "Show price" option to allow prices to be shown or hidden in Jetpack Instant Search results.
1414

1515
### Changed
16+
- Instant Search: Show WooCommerce product filters in filter widget.
1617
- Update package dependencies.
1718

1819
## [0.54.10] - 2026-01-12

jetpack_vendor/automattic/jetpack-search/src/widgets/class-search-widget.php

Lines changed: 12 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -694,21 +694,18 @@ public function update( $new_instance, $old_instance ) { // phpcs:ignore Variabl
694694
'interval' => sanitize_key( $new_instance['date_histogram_interval'][ $index ] ?? '' ),
695695
);
696696
break;
697-
// phpcs:disable Squiz.PHP.CommentedOutCode.Found
698-
// TODO: Uncomment when Search rebuild is complete (search for: product_attribute filter).
699-
// case 'product_attribute':
700-
// $filter_data = array(
701-
// 'name' => sanitize_text_field( $new_instance['filter_name'][ $index ] ),
702-
// 'type' => 'product_attribute',
703-
// 'count' => $count,
704-
// );
705-
// Save included attributes if any are selected.
706-
// if ( isset( $new_instance[ 'included_attributes_' . $index ] ) && is_array( $new_instance[ 'included_attributes_' . $index ] ) ) {
707-
// $filter_data['included_attributes'] = array_map( 'sanitize_key', $new_instance[ 'included_attributes_' . $index ] );
708-
// }
709-
// $filters[] = $filter_data;
710-
// break.
711-
// phpcs:enable Squiz.PHP.CommentedOutCode.Found
697+
case 'product_attribute':
698+
$filter_data = array(
699+
'name' => sanitize_text_field( $new_instance['filter_name'][ $index ] ?? '' ),
700+
'type' => 'product_attribute',
701+
'count' => $count,
702+
);
703+
// Save included attributes if any are selected.
704+
if ( isset( $new_instance[ 'included_attributes_' . $index ] ) && is_array( $new_instance[ 'included_attributes_' . $index ] ) ) {
705+
$filter_data['included_attributes'] = array_map( 'sanitize_key', $new_instance[ 'included_attributes_' . $index ] );
706+
}
707+
$filters[] = $filter_data;
708+
break;
712709
}
713710
}
714711
}
@@ -1014,11 +1011,9 @@ public function render_widget_edit_filter( $filter, $is_template = false, $is_in
10141011
<option value="date_histogram" <?php $this->render_widget_option_selected( 'type', $args['type'], 'date_histogram', $is_template ); ?>>
10151012
<?php esc_html_e( 'Date', 'jetpack-search-pkg' ); ?>
10161013
</option>
1017-
<!-- TODO: Uncomment when Search rebuild is complete (search for: product_attribute filter).
10181014
<option value="product_attribute" <?php $this->render_widget_option_selected( 'type', $args['type'], 'product_attribute', $is_template ); ?>>
10191015
<?php esc_html_e( 'Product Attributes', 'jetpack-search-pkg' ); ?>
10201016
</option>
1021-
-->
10221017
</select>
10231018
</label>
10241019
</p>

jetpack_vendor/i18n-map.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -134,7 +134,7 @@
134134
),
135135
'jetpack-search-pkg' => array(
136136
'path' => 'jetpack_vendor/automattic/jetpack-search',
137-
'ver' => '0.55.0-alpha1768313867',
137+
'ver' => '0.55.0-alpha1768316408',
138138
),
139139
'jetpack-stats' => array(
140140
'path' => 'jetpack_vendor/automattic/jetpack-stats',

0 commit comments

Comments
 (0)