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

Conversation

gigitux
Copy link
Contributor

@gigitux gigitux commented Sep 20, 2022

This PR adds support for the Filter By Attributes block. This PR is blocked by #7162.

#6790

Screenshots

image

Testing

Automated Tests

User Facing Testing

  1. Create a new post/page and add the Product Query block and the Filter By Attributes block.
  2. On the front-end side, apply some filters and be sure that they are applied correctly.
  3. Edit the post/page and add the Product Query block and enable "Show only products on sale" option.
  4. On the front-end side, apply some filters and be sure that they are applied correctly.
  5. Edit the post/page and add a Query Loop block.
  6. On the front-end side, apply some filters, be sure that the filters are applied correctly and the Query Loop works correctly (continue to show posts).
  7. Do the same steps (1-6), but instead add in a post/page, add the blocks in an FSE template (for example Product Catalog template).

Note
During your test, pay attention to the pagination too.

  • Do not include in the Testing Notes

WooCommerce Visibility

  • WooCommerce Core
  • Feature plugin
  • Experimental

Performance Impact

Changelog

N/A

@gigitux gigitux self-assigned this Sep 20, 2022
@github-actions
Copy link
Contributor

The release ZIP for this PR is accessible via:

https://wcblocks.wpcomstaging.com/wp-content/uploads/woocommerce-gutenberg-products-block-7186.zip

@github-actions
Copy link
Contributor

github-actions bot commented Sep 20, 2022

Size Change: 0 B

Total Size: 992 kB

ℹ️ View Unchanged
Filename Size
build/active-filters-frontend.js 7.73 kB
build/active-filters-wrapper-frontend.js 6 kB
build/active-filters.js 7.44 kB
build/all-products-frontend.js 26.5 kB
build/all-products.js 33.6 kB
build/all-reviews.js 7.79 kB
build/attribute-filter-frontend.js 22.5 kB
build/attribute-filter-wrapper-frontend.js 7.04 kB
build/attribute-filter.js 12.4 kB
build/blocks-checkout.js 17.5 kB
build/cart-blocks/cart-accepted-payment-methods-frontend.js 1.38 kB
build/cart-blocks/cart-cross-sells-frontend.js 253 B
build/cart-blocks/cart-cross-sells-products--product-add-to-cart-frontend.js 5.64 kB
build/cart-blocks/cart-cross-sells-products-frontend.js 4.67 kB
build/cart-blocks/cart-express-payment--checkout-blocks/express-payment-frontend.js 5.1 kB
build/cart-blocks/cart-express-payment-frontend.js 786 B
build/cart-blocks/cart-items-frontend.js 299 B
build/cart-blocks/cart-line-items--mini-cart-contents-block/products-table-frontend.js 5.31 kB
build/cart-blocks/cart-line-items-frontend.js 1.07 kB
build/cart-blocks/cart-order-summary-frontend.js 1.11 kB
build/cart-blocks/cart-totals-frontend.js 320 B
build/cart-blocks/empty-cart-frontend.js 346 B
build/cart-blocks/filled-cart-frontend.js 783 B
build/cart-blocks/order-summary-coupon-form-frontend.js 2.73 kB
build/cart-blocks/order-summary-discount-frontend.js 2.16 kB
build/cart-blocks/order-summary-fee-frontend.js 272 B
build/cart-blocks/order-summary-heading-frontend.js 455 B
build/cart-blocks/order-summary-shipping--checkout-blocks/order-summary-shipping-frontend.js 6.61 kB
build/cart-blocks/order-summary-shipping-frontend.js 428 B
build/cart-blocks/order-summary-subtotal-frontend.js 273 B
build/cart-blocks/order-summary-taxes-frontend.js 433 B
build/cart-blocks/proceed-to-checkout-frontend.js 1.19 kB
build/cart-frontend.js 54.5 kB
build/cart.js 47.5 kB
build/checkout-blocks/actions-frontend.js 1.78 kB
build/checkout-blocks/billing-address--checkout-blocks/shipping-address-frontend.js 4.98 kB
build/checkout-blocks/billing-address-frontend.js 954 B
build/checkout-blocks/contact-information-frontend.js 3.02 kB
build/checkout-blocks/express-payment-frontend.js 1.17 kB
build/checkout-blocks/fields-frontend.js 343 B
build/checkout-blocks/order-note-frontend.js 1.14 kB
build/checkout-blocks/order-summary-cart-items-frontend.js 3.67 kB
build/checkout-blocks/order-summary-coupon-form-frontend.js 2.89 kB
build/checkout-blocks/order-summary-discount-frontend.js 2.28 kB
build/checkout-blocks/order-summary-fee-frontend.js 275 B
build/checkout-blocks/order-summary-frontend.js 1.11 kB
build/checkout-blocks/order-summary-shipping-frontend.js 603 B
build/checkout-blocks/order-summary-subtotal-frontend.js 273 B
build/checkout-blocks/order-summary-taxes-frontend.js 433 B
build/checkout-blocks/payment-frontend.js 7.86 kB
build/checkout-blocks/shipping-address-frontend.js 1.06 kB
build/checkout-blocks/shipping-methods-frontend.js 4.89 kB
build/checkout-blocks/terms-frontend.js 1.64 kB
build/checkout-blocks/totals-frontend.js 323 B
build/checkout-frontend.js 56.6 kB
build/checkout.js 41.3 kB
build/featured-category.js 13.2 kB
build/featured-product.js 13.5 kB
build/filter-wrapper-frontend.js 13.8 kB
build/filter-wrapper.js 2.39 kB
build/general-style-rtl.css 1.29 kB
build/general-style.css 1.29 kB
build/handpicked-products.js 7.33 kB
build/legacy-template.js 2.83 kB
build/mini-cart-component-frontend.js 20.2 kB
build/mini-cart-contents-block/empty-cart-frontend.js 367 B
build/mini-cart-contents-block/filled-cart-frontend.js 230 B
build/mini-cart-contents-block/footer-frontend.js 2.98 kB
build/mini-cart-contents-block/items-frontend.js 236 B
build/mini-cart-contents-block/products-table-frontend.js 590 B
build/mini-cart-contents-block/shopping-button-frontend.js 287 B
build/mini-cart-contents-block/title-frontend.js 367 B
build/mini-cart-contents.js 16.8 kB
build/mini-cart-frontend.js 1.71 kB
build/mini-cart.js 4.57 kB
build/price-filter-frontend.js 13.6 kB
build/price-filter-wrapper-frontend.js 6.95 kB
build/price-filter.js 8.47 kB
build/price-format.js 1.19 kB
build/product-add-to-cart--product-button--product-category-list--product-image--product-price--product-r--a0326d00.js 227 B
build/product-add-to-cart--product-button--product-image--product-title.js 2.67 kB
build/product-add-to-cart-frontend.js 1.25 kB
build/product-add-to-cart.js 6.48 kB
build/product-best-sellers.js 7.7 kB
build/product-button--product-category-list--product-image--product-price--product-rating--product-sale-b--e17c7c01.js 433 B
build/product-button--product-image--product-rating--product-sale-badge--product-title.js 301 B
build/product-button-frontend.js 1.89 kB
build/product-button.js 1.58 kB
build/product-categories.js 2.36 kB
build/product-category-list-frontend.js 881 B
build/product-category-list.js 502 B
build/product-category.js 8.69 kB
build/product-image-frontend.js 1.91 kB
build/product-image.js 1.62 kB
build/product-new.js 7.69 kB
build/product-on-sale.js 8.01 kB
build/product-price-frontend.js 1.92 kB
build/product-price.js 1.53 kB
build/product-query.js 2.46 kB
build/product-rating-frontend.js 1.18 kB
build/product-rating.js 773 B
build/product-sale-badge-frontend.js 1.15 kB
build/product-sale-badge.js 817 B
build/product-search.js 2.61 kB
build/product-sku-frontend.js 380 B
build/product-sku.js 380 B
build/product-stock-indicator-frontend.js 997 B
build/product-stock-indicator.js 624 B
build/product-summary-frontend.js 1.29 kB
build/product-summary.js 921 B
build/product-tag-list-frontend.js 877 B
build/product-tag-list.js 497 B
build/product-tag.js 8.05 kB
build/product-title-frontend.js 1.34 kB
build/product-title.js 937 B
build/product-top-rated.js 7.93 kB
build/products-by-attribute.js 8.61 kB
build/rating-filter-frontend.js 7.09 kB
build/rating-filter-wrapper-frontend.js 5.34 kB
build/rating-filter.js 6.26 kB
build/reviews-by-category.js 11.3 kB
build/reviews-by-product.js 12.4 kB
build/reviews-frontend.js 7.01 kB
build/single-product-frontend.js 32.3 kB
build/single-product.js 10.1 kB
build/stock-filter-frontend.js 7.73 kB
build/stock-filter-wrapper-frontend.js 5.99 kB
build/stock-filter.js 6.65 kB
build/vendors--attribute-filter-wrapper--mini-cart-contents-block/footer-frontend.js 6.86 kB
build/vendors--attribute-filter-wrapper-frontend.js 8.21 kB
build/vendors--cart-blocks/cart-cross-sells-products--cart-blocks/cart-line-items--cart-blocks/cart-order--671ca56f-frontend.js 5.26 kB
build/vendors--cart-blocks/cart-cross-sells-products--cart-blocks/order-summary-shipping--checkout-blocks--18f9376a-frontend.js 19.1 kB
build/vendors--cart-blocks/cart-cross-sells-products--product-add-to-cart-frontend.js 7.53 kB
build/vendors--cart-blocks/cart-line-items--checkout-blocks/order-summary-cart-items--mini-cart-contents---233ab542-frontend.js 3.14 kB
build/vendors--cart-blocks/order-summary-shipping--checkout-blocks/billing-address--checkout-blocks/order--5b8feb0b-frontend.js 4.85 kB
build/wc-blocks-data.js 18.3 kB
build/wc-blocks-editor-style-rtl.css 5.24 kB
build/wc-blocks-editor-style.css 5.24 kB
build/wc-blocks-google-analytics.js 1.56 kB
build/wc-blocks-middleware.js 932 B
build/wc-blocks-registry.js 2.93 kB
build/wc-blocks-shared-context.js 1.52 kB
build/wc-blocks-shared-hocs.js 1.72 kB
build/wc-blocks-style-rtl.css 24.2 kB
build/wc-blocks-style.css 24.1 kB
build/wc-blocks-vendors-style-rtl.css 1.95 kB
build/wc-blocks-vendors-style.css 1.95 kB
build/wc-blocks-vendors.js 62.4 kB
build/wc-blocks.js 2.62 kB
build/wc-payment-method-bacs.js 816 B
build/wc-payment-method-cheque.js 811 B
build/wc-payment-method-cod.js 909 B
build/wc-payment-method-paypal.js 837 B
build/wc-settings.js 2.6 kB

compressed-size-action

@gigitux gigitux force-pushed the add/attribute_filter_support branch from 8fe6700 to 166bd49 Compare September 20, 2022 14:55
@gigitux gigitux marked this pull request as ready for review September 20, 2022 14:55
@rubikuserbot rubikuserbot requested review from a team and sunyatasattva and removed request for a team September 20, 2022 14:55
@gigitux gigitux force-pushed the add/attribute_filter_support branch from 166bd49 to a9fa429 Compare September 20, 2022 14:57
Product Query - Add support for the Filter By Attributes block
@gigitux gigitux force-pushed the add/attribute_filter_support branch from a9fa429 to 926f62c Compare September 20, 2022 14:57
@gigitux gigitux force-pushed the add/attribute_filter_support branch from c771df8 to 0be510e Compare September 22, 2022 09:02
Copy link
Contributor

@sunyatasattva sunyatasattva left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Incredible work! I left a few comments, but nothing major. I just think the code could be slightly improved on the readability side.

add_filter( 'query_vars', array( $this, 'set_query_vars' ) );
// Set this so that our product filters can detect if it's a PHP template.
$this->asset_data_registry->add( 'has_filterable_products', true, true );
$this->asset_data_registry->add( 'is_rendering_php_template', true, true );
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry, I don't exactly know how this works, but should we always set this to true even when not rendering PHP templates? Or should we wrap this into a condition of some sort?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I fixed this in the previous PR #7162

'tax_query' => array(),
);

$queries_attributes = $this->get_queries_by_attributes( $variation_props );
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This function seems to return a list of queries, right? So perhaps let's call this variable something different? Like $queries_by_attributes is the obvious one. Or just $custom_queries.

);

$queries_attributes = $this->get_queries_by_attributes( $variation_props );
$queries_filters = $this->get_queries_by_applied_filters();
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same idea as above. Maybe let's call this $filters_queries if you wanna keep it similar to this. But AFAIU this returns the queries from the filters, and not filters themselves, right? So it'd be a bit more semantically appropriate, I feel.

Comment on lines 110 to 120
if ( isset( $query['post__in'] ) ) {
$acc['post__in'] = isset( $acc['post__in'] ) ? array_merge( $acc['post__in'], $query['post__in'] ) : $query['post__in'];
}
// Ignoring the warning of not using meta queries.
// phpcs:ignore WordPress.DB.SlowDBQuery.slow_db_query_meta_query
$acc['meta_query'] = isset( $query['meta_query'] ) ? array_merge( $acc['meta_query'], array( $query['meta_query'] ) ) : $acc['meta_query'];
// phpcs:ignore WordPress.DB.SlowDBQuery.slow_db_query_tax_query
$acc['tax_query'] = isset( $query['tax_query'] ) ? array_merge( $acc['tax_query'], array( $query['tax_query'] ) ) : $acc['tax_query'];
return $acc;
},
$common_query_values
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd suggest we add post__in in $common_query_values as an empty array. In this way we can remove all the ternary operators in this function, I think, making it a bit easier to read. In the end, it's a super simple function, but it looks complicated honestly.

Comment on lines 14 to 15
const FILTER_QUERY_VAR = 'filter_';
const QUERY_TYPE_QUERY_VAR = 'query_type_';
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do you think these need to be part of the AttributeFilter class? In the end, they only get used by our class, so maybe it makes more sense to move them there? Not sure though. What do you think?

I'd also rename them to something like FILTER_QUERY_VAR_PREFIX.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I did the same thing for the `PriceFilter.php≠. These constants indicate the query arguments that are added to the URL when the filters are applied. For me, it makes sense, keeping them scoped with the filters.

* @return array
*/
private function get_filter_by_attributes_query_vars() {

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Are empty lines at the beginning of the functions a thing we do or was this a typo?

Comment on lines 169 to 176
function( $acc, $attribute ) {
$acc[ $attribute->attribute_name ] = array(
'filter' => AttributeFilter::FILTER_QUERY_VAR . $attribute->attribute_name,
'query_type' => AttributeFilter::QUERY_TYPE_QUERY_VAR . $attribute->attribute_name,
);
return $acc;
},
array()
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd probably refactor this function as it's own thing. Not so much because it will be reused, but to make things a bit clearer. Like generate_attribute_filters or something like that?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Mmm, I don't see any advantages to creating a dedicated function. This function is pretty easy to understand and also the class is already huge.

$attribute_name_value = explode( ',', $attribute_name_value );

$acc[] = array(
'taxonomy' => str_replace( AttributeFilter::FILTER_QUERY_VAR, 'pa_', $attribute_name ),
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What does pa_ stand for?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good question... the pa is the prefix for custom attributes:
image

We do a similar thing here

Comment on lines 259 to 260
$attribute_name_value = get_query_var( $attribute_name );
$attribute_query_type_value = get_query_var( $attribute_query_type );
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd put just $attribute_value and $attribute_query.

return $acc;
}

$attribute_name_value = explode( ',', $attribute_name_value );
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could you add some comments as to why we explode it here?

@gigitux gigitux changed the title [Product Query] Add support for the Filter By Attributes block [Product Query] Add support for the Filter Products By Attributes block Sep 29, 2022
@github-actions
Copy link
Contributor

github-actions bot commented Oct 7, 2022

This PR has been marked as stale because it has not seen any activity within the past 60 days. Our team uses this tool to help surface pull requests that have slipped through review.

If deemed still relevant, the pr can be kept active by ensuring it's up to date with the main branch and removing the stale label - otherwise it will automatically be closed after 10 days.

@github-actions github-actions bot added the status: stale Stale issues and PRs have had no updates for 60 days. label Oct 7, 2022
@gigitux gigitux removed the status: stale Stale issues and PRs have had no updates for 60 days. label Oct 7, 2022
@github-actions
Copy link
Contributor

github-actions bot commented Oct 13, 2022

Script Dependencies Report

The compare-assets action has detected some changed script dependencies between this branch and trunk. Please review and confirm the following are correct before merging.

Script Handle Added Removed
reviews-frontend.js react, wc-settings, wp-a11y, wp-api-fetch, wp-compose, wp-element, wp-html-entities, wp-i18n, wp-is-shallow-equal, wp-polyfill ⚠️
all-products-frontend.js lodash, react, wc-blocks-data-store, wc-blocks-registry, wc-blocks-shared-context, wc-blocks-shared-hocs, wc-price-format, wc-settings, wp-a11y, wp-api-fetch, wp-autop, wp-block-editor, wp-blocks, wp-compose, wp-data, wp-deprecated, wp-dom, wp-element, wp-hooks, wp-html-entities, wp-i18n, wp-is-shallow-equal, wp-polyfill, wp-primitives, wp-url, wp-warning, wp-wordcount ⚠️
price-filter-frontend.js lodash, react, wc-blocks-data-store, wc-price-format, wc-settings, wp-data, wp-element, wp-i18n, wp-is-shallow-equal, wp-polyfill, wp-url ⚠️
attribute-filter-frontend.js lodash, react, wc-blocks-checkout, wc-blocks-data-store, wc-settings, wp-a11y, wp-block-editor, wp-blocks, wp-compose, wp-data, wp-deprecated, wp-dom, wp-element, wp-html-entities, wp-i18n, wp-is-shallow-equal, wp-keycodes, wp-polyfill, wp-primitives, wp-url, wp-warning ⚠️
stock-filter-frontend.js lodash, react, wc-blocks-checkout, wc-blocks-data-store, wc-settings, wp-a11y, wp-data, wp-element, wp-html-entities, wp-i18n, wp-is-shallow-equal, wp-polyfill, wp-url ⚠️
active-filters-frontend.js lodash, react, wc-blocks-data-store, wc-price-format, wc-settings, wp-data, wp-element, wp-html-entities, wp-i18n, wp-is-shallow-equal, wp-polyfill, wp-primitives, wp-url ⚠️
rating-filter-frontend.js lodash, react, wc-blocks-checkout, wc-blocks-data-store, wc-settings, wp-a11y, wp-data, wp-element, wp-i18n, wp-is-shallow-equal, wp-polyfill, wp-url ⚠️
cart-frontend.js lodash, react, wc-blocks-checkout, wc-blocks-data-store, wc-blocks-registry, wc-blocks-shared-context, wc-blocks-shared-hocs, wc-price-format, wc-settings, wp-a11y, wp-api-fetch, wp-autop, wp-block-editor, wp-blocks, wp-compose, wp-data, wp-deprecated, wp-dom, wp-element, wp-hooks, wp-html-entities, wp-i18n, wp-is-shallow-equal, wp-keycodes, wp-plugins, wp-polyfill, wp-primitives, wp-url, wp-warning, wp-wordcount ⚠️
checkout-frontend.js lodash, react, wc-blocks-checkout, wc-blocks-data-store, wc-blocks-registry, wc-blocks-shared-hocs, wc-price-format, wc-settings, wp-a11y, wp-api-fetch, wp-autop, wp-compose, wp-data, wp-deprecated, wp-dom, wp-element, wp-hooks, wp-html-entities, wp-i18n, wp-is-shallow-equal, wp-keycodes, wp-plugins, wp-polyfill, wp-primitives, wp-url, wp-warning, wp-wordcount ⚠️
mini-cart-frontend.js wc-settings, wp-polyfill ⚠️
single-product-frontend.js lodash, react, wc-blocks-checkout, wc-blocks-data-store, wc-blocks-registry, wc-blocks-shared-context, wc-blocks-shared-hocs, wc-price-format, wc-settings, wp-a11y, wp-api-fetch, wp-autop, wp-block-editor, wp-blocks, wp-compose, wp-data, wp-deprecated, wp-dom, wp-element, wp-hooks, wp-html-entities, wp-i18n, wp-is-shallow-equal, wp-polyfill, wp-primitives, wp-url, wp-warning, wp-wordcount ⚠️
filter-wrapper-frontend.js lodash, react, wc-blocks-checkout, wc-blocks-data-store, wc-blocks-registry, wc-price-format, wc-settings, wp-a11y, wp-block-editor, wp-blocks, wp-compose, wp-data, wp-deprecated, wp-dom, wp-element, wp-html-entities, wp-i18n, wp-is-shallow-equal, wp-keycodes, wp-polyfill, wp-primitives, wp-url, wp-warning ⚠️
mini-cart-component-frontend.js lodash, react, wc-blocks-checkout, wc-blocks-data-store, wc-blocks-registry, wc-price-format, wc-settings, wp-a11y, wp-autop, wp-components, wp-compose, wp-data, wp-deprecated, wp-dom, wp-element, wp-hooks, wp-html-entities, wp-i18n, wp-is-shallow-equal, wp-keycodes, wp-polyfill, wp-primitives, wp-url, wp-warning, wp-wordcount ⚠️

This comment was automatically generated by the ./github/compare-assets action.

Copy link
Contributor

@sunyatasattva sunyatasattva left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It works like a charm! I mean… it's exactly the experience we had expected (and I hope we don't decide to go to production with this version), but it works as specced so far.

Thanks for addressing my previous comments. I've left a few more, but they are minor. I'm pre-approving.

Comment on lines +144 to +150
$attributes_filter_query_args = array_reduce(
array_values( $this->get_filter_by_attributes_query_vars() ),
function( $acc, $array ) {
return array_merge( array_values( $array ), $acc );
},
array()
);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It looks great now, thanks! It helps a lot actually to follow what's the expected shape… until we get TypePHP 😬

return $acc;
}

// It is necessary explode the value because $attribute_value can be a string with multiple values (e.g. "red,blue").
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you for this comment!

}

/**
* Intersect arrays when both are not empty, otherwise merge them.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just a little grammar fix

Suggested change
* Intersect arrays when both are not empty, otherwise merge them.
* Intersect arrays when neither of them are empty, otherwise merge them.

Comment on lines 331 to 332
* @param array $array1 Array.
* @param array $array2 Array.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You know from the other PR how I feel about these kind of names, but I don't want to be too obnoxious. Again, if we want to keep two args, I'd go for $a and $b, but my suggestion would be to mimic the signature of both array_merge and array_intersect and accept any number of arguments.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I updated the function. Before merging the PR, I prefer that you take a last check :)

@github-actions github-actions bot modified the milestone: 8.8.0 Oct 17, 2022
@opr opr modified the milestones: 8.8.0, 8.9.0 Oct 24, 2022
Copy link
Contributor

@sunyatasattva sunyatasattva left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Love it! Thank you a lot!

@gigitux gigitux merged commit 13c1edd into trunk Oct 26, 2022
@gigitux gigitux deleted the add/attribute_filter_support branch October 26, 2022 14:53
senadir pushed a commit to senadir/woocommerce-blocks that referenced this pull request Nov 12, 2022
…ck (woocommerce#7186)

* Product Query: Fix pagination issue

* Product Query - Add support for the Filter By Price Block woocommerce#6790

Product Query - Add support for the Filter By Price Block

* fix query relation

* fix on sale query

* Product Query - Add support for the Filter By Attributes block woocommerce#6790

Product Query - Add support for the Filter By Attributes block

* fix bugged pagination and on-sale filter after refactor

* address feedback

* address feedback
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
block-type: product-query Issues related to/affecting all product-query variations. skip-changelog PRs that you don't want to appear in the changelog.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants