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

Make Attribute Filter block compatible with PHP rendered Classic Template block #6204

Merged
merged 11 commits into from
Apr 14, 2022

Conversation

tjcafferkey
Copy link
Contributor

@tjcafferkey tjcafferkey commented Apr 6, 2022

Update the Filter Attribute block to work with the Classic Template block which is PHP rendered, but also still maintain compatibility with the All Products block.

Filter Products by Attribute block will only work with the PHP rendered Classic Template block if the filters are applied to the URL and the page is re-rendered. This behaviour happens with the Classic Themes such as Storefront.

Fixes #6136

Testing

Automated Tests

  • Changes in this PR are covered by Automated Tests.
    • Unit tests
    • E2E tests

Manual Testing

How to test the changes in this Pull Request:

  1. With a block theme, go to Appearance > Editor > Template > Product Catalog.
  2. Add the Filter Products by Attribute block above the product grid.
  3. Check some of the attributes on the frontend
  4. Notice the page reloads and the list of products updates accordingly.
  5. Now add the "Active Filters" block and repeat steps 1-4 and view the active filters appear upon page reload. Please bare in mind the "Clear All" functionality will not work with the Active Filters block yet, this needs to be worked on separately.
  6. Add a test page to your site with the All Products block, and the Filter by Attribute block and ensure no regressions have been introduced here.

User Facing Testing

These are steps for user testing (where "user" is someone interacting with this change that is not editing any code).

  • Same as above, or
  • See steps below.

Changelog

Allow adding the Filter Products by Attribute block to Product Catalog templates to filter products.

@tjcafferkey tjcafferkey added type: enhancement The issue is a request for an enhancement. block: filter by attribute Issues related to the Filter by Attribute block. labels Apr 6, 2022
@tjcafferkey tjcafferkey self-assigned this Apr 6, 2022
@tjcafferkey tjcafferkey requested a review from Aljullu April 6, 2022 14:40
@rubikuserbot rubikuserbot requested a review from a team April 6, 2022 14:40
@github-actions
Copy link
Contributor

github-actions bot commented Apr 6, 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
attribute-filter.js wp-url ⚠️

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

@github-actions
Copy link
Contributor

github-actions bot commented Apr 6, 2022

Size Change: +1.24 kB (0%)

Total Size: 863 kB

Filename Size Change
build/active-filters-frontend.js 5.92 kB +2 B (0%)
build/active-filters.js 6.59 kB +3 B (0%)
build/all-products-frontend.js 18.1 kB -7 B (0%)
build/all-products.js 33.5 kB +6 B (0%)
build/all-reviews.js 7.77 kB -3 B (0%)
build/attribute-filter-frontend.js 17.5 kB +649 B (+4%)
build/attribute-filter.js 13.4 kB +592 B (+5%) 🔍
build/cart-blocks/cart-accepted-payment-methods-frontend.js 1.16 kB +1 B (0%)
build/cart-blocks/cart-express-payment-frontend.js 5.24 kB +6 B (0%)
build/cart-blocks/cart-line-items--mini-cart-contents-block/products-table-frontend.js 5.27 kB -2 B (0%)
build/cart-blocks/cart-line-items-frontend.js 431 B +1 B (0%)
build/cart-blocks/order-summary-coupon-form-frontend.js 2.81 kB +1 B (0%)
build/cart-blocks/order-summary-discount-frontend.js 2.31 kB -2 B (0%)
build/cart-blocks/order-summary-shipping--checkout-blocks/order-summary-shipping-frontend.js 6.33 kB -8 B (0%)
build/cart-blocks/order-summary-shipping-frontend.js 427 B -1 B (0%)
build/cart-blocks/proceed-to-checkout-frontend.js 1.16 kB +4 B (0%)
build/cart-frontend.js 45.5 kB -4 B (0%)
build/cart.js 44.3 kB -6 B (0%)
build/checkout-blocks/actions-frontend.js 1.41 kB -2 B (0%)
build/checkout-blocks/billing-address--checkout-blocks/shipping-address-frontend.js 4.12 kB -1 B (0%)
build/checkout-blocks/express-payment-frontend.js 5.54 kB +5 B (0%)
build/checkout-blocks/fields-frontend.js 343 B -2 B (-1%)
build/checkout-blocks/order-note-frontend.js 1.07 kB -2 B (0%)
build/checkout-blocks/order-summary-cart-items-frontend.js 3.67 kB +4 B (0%)
build/checkout-blocks/order-summary-coupon-form-frontend.js 2.97 kB +2 B (0%)
build/checkout-blocks/order-summary-frontend.js 1.1 kB -1 B (0%)
build/checkout-blocks/order-summary-shipping-frontend.js 605 B -1 B (0%)
build/checkout-blocks/payment-frontend.js 7.82 kB -2 B (0%)
build/checkout-blocks/shipping-address-frontend.js 996 B +1 B (0%)
build/checkout-blocks/shipping-methods-frontend.js 4.72 kB +4 B (0%)
build/checkout-blocks/totals-frontend.js 325 B -1 B (0%)
build/checkout-frontend.js 47.7 kB -6 B (0%)
build/checkout.js 45.5 kB -9 B (0%)
build/featured-category.js 8.63 kB -4 B (0%)
build/featured-product.js 10.5 kB +2 B (0%)
build/legacy-template.js 2.19 kB -1 B (0%)
build/mini-cart-component-frontend.js 16.6 kB +6 B (0%)
build/mini-cart-contents-block/footer--mini-cart-contents-block/products-table-frontend.js 4.68 kB -2 B (0%)
build/mini-cart-contents-block/footer-frontend.js 5.64 kB +3 B (0%)
build/mini-cart-contents-block/products-table-frontend.js 289 B +1 B (0%)
build/mini-cart-contents.js 22.7 kB -5 B (0%)
build/mini-cart-frontend.js 1.72 kB -1 B (0%)
build/price-filter-frontend.js 12.4 kB +12 B (0%)
build/price-filter.js 8.41 kB +3 B (0%)
build/product-add-to-cart--product-button--product-image--product-title.js 2.65 kB +1 B (0%)
build/product-add-to-cart-frontend.js 6.96 kB -5 B (0%)
build/product-add-to-cart.js 6.63 kB -3 B (0%)
build/product-button--product-category-list--product-image--product-price--product-rating--product-sale-b--e17c7c01.js 502 B +1 B (0%)
build/product-button-frontend.js 1.84 kB +1 B (0%)
build/product-categories.js 2.78 kB -4 B (0%)
build/product-category-list-frontend.js 926 B +2 B (0%)
build/product-category-list.js 501 B +1 B (0%)
build/product-category.js 8.49 kB -4 B (0%)
build/product-image-frontend.js 1.84 kB +3 B (0%)
build/product-image.js 1.07 kB -1 B (0%)
build/product-on-sale.js 7.99 kB -1 B (0%)
build/product-price-frontend.js 1.94 kB +2 B (0%)
build/product-rating-frontend.js 1.15 kB +2 B (0%)
build/product-rating.js 733 B -2 B (0%)
build/product-sale-badge-frontend.js 1.09 kB +1 B (0%)
build/product-sale-badge.js 678 B -1 B (0%)
build/product-search.js 2.18 kB -1 B (0%)
build/product-sku.js 381 B -1 B (0%)
build/product-stock-indicator-frontend.js 1.03 kB +3 B (0%)
build/product-stock-indicator.js 621 B +1 B (0%)
build/product-summary-frontend.js 1.33 kB +3 B (0%)
build/product-summary.js 919 B +1 B (0%)
build/product-tag-list.js 496 B +1 B (0%)
build/product-tag.js 7.81 kB -2 B (0%)
build/product-title.js 909 B -1 B (0%)
build/product-top-rated.js 7.91 kB -1 B (0%)
build/reviews-by-category.js 11.2 kB -3 B (0%)
build/single-product-frontend.js 21.5 kB -5 B (0%)
build/single-product.js 10 kB +7 B (0%)
build/stock-filter.js 6.56 kB +6 B (0%)
build/vendors--cart-blocks/order-summary-shipping--checkout-blocks/billing-address--checkout-blocks/order--5b8feb0b-frontend.js 4.75 kB +3 B (0%)
build/vendors--cart-blocks/order-summary-shipping--checkout-blocks/billing-address--checkout-blocks/order--decc3dc6-frontend.js 20.5 kB +2 B (0%)
build/vendors--mini-cart-contents-block/footer-frontend.js 6.86 kB -1 B (0%)
build/vendors--product-add-to-cart-frontend.js 7.53 kB +2 B (0%)
build/wc-blocks.js 2.63 kB +1 B (0%)
ℹ️ View Unchanged
Filename Size
build/blocks-checkout.js 17.4 kB
build/cart-blocks/cart-items-frontend.js 298 B
build/cart-blocks/cart-order-summary-frontend.js 1.1 kB
build/cart-blocks/cart-totals-frontend.js 321 B
build/cart-blocks/empty-cart-frontend.js 345 B
build/cart-blocks/filled-cart-frontend.js 772 B
build/cart-blocks/order-summary-fee-frontend.js 273 B
build/cart-blocks/order-summary-heading-frontend.js 454 B
build/cart-blocks/order-summary-subtotal-frontend.js 273 B
build/cart-blocks/order-summary-taxes-frontend.js 433 B
build/checkout-blocks/billing-address-frontend.js 893 B
build/checkout-blocks/contact-information-frontend.js 2.83 kB
build/checkout-blocks/order-summary-discount-frontend.js 2.43 kB
build/checkout-blocks/order-summary-fee-frontend.js 275 B
build/checkout-blocks/order-summary-subtotal-frontend.js 273 B
build/checkout-blocks/order-summary-taxes-frontend.js 432 B
build/checkout-blocks/terms-frontend.js 1.22 kB
build/handpicked-products.js 7.11 kB
build/mini-cart-contents-block/empty-cart-frontend.js 327 B
build/mini-cart-contents-block/filled-cart-frontend.js 230 B
build/mini-cart-contents-block/items-frontend.js 226 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.js 6.1 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 224 B
build/product-add-to-cart--product-button.js 565 B
build/product-best-sellers.js 7.38 kB
build/product-button.js 1.08 kB
build/product-new.js 7.68 kB
build/product-price.js 1.5 kB
build/product-sku-frontend.js 380 B
build/product-tag-list-frontend.js 918 B
build/product-title-frontend.js 1.29 kB
build/products-by-attribute.js 8.39 kB
build/reviews-by-product.js 12.3 kB
build/reviews-frontend.js 7 kB
build/stock-filter-frontend.js 6.5 kB
build/vendors--cart-blocks/cart-line-items--cart-blocks/cart-order-summary--cart-blocks/order-summary-shi--c02aad66-frontend.js 5.26 kB
build/vendors--cart-blocks/cart-line-items--checkout-blocks/order-summary-cart-items--mini-cart-contents---233ab542-frontend.js 3.14 kB
build/wc-blocks-data.js 9.87 kB
build/wc-blocks-editor-style-rtl.css 4.92 kB
build/wc-blocks-editor-style.css 4.92 kB
build/wc-blocks-google-analytics.js 1.56 kB
build/wc-blocks-middleware.js 930 B
build/wc-blocks-registry.js 2.7 kB
build/wc-blocks-shared-context.js 1.52 kB
build/wc-blocks-shared-hocs.js 1.14 kB
build/wc-blocks-style-rtl.css 22 kB
build/wc-blocks-style.css 22 kB
build/wc-blocks-vendors-style-rtl.css 1.28 kB
build/wc-blocks-vendors-style.css 1.28 kB
build/wc-blocks-vendors.js 71.3 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.61 kB

compressed-size-action

@github-actions
Copy link
Contributor

github-actions bot commented Apr 7, 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
attribute-filter.js wp-url ⚠️

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

@tjcafferkey
Copy link
Contributor Author

Failing E2E tests appear unrelated.

Copy link
Contributor

@Aljullu Aljullu left a comment

Choose a reason for hiding this comment

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

Overall this is looking good, but I found a couple of issues while testing:

First, I don't seem to be able to remove the last attribute filter, is that expected?

Kooha-04-07-2022-10-41-31
(it's not obvious from the GIF, but I'm pressing the checkbox and nothing happens 😅 )

The second one happens when I set the Display Style to Dropdown in the editor. The block crashes after I select one filter:

Kooha-04-07-2022-10-43-37

Can you reproduce them?

@github-actions
Copy link
Contributor

github-actions bot commented Apr 7, 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
wc-blocks.js wp-blocks, wp-compose, wp-element, wp-hooks, wp-i18n, wp-polyfill, wp-primitives ⚠️
handpicked-products.js lodash, react, wc-settings, wp-api-fetch, wp-block-editor, wp-blocks, wp-components, wp-compose, wp-element, wp-escape-html, wp-html-entities, wp-i18n, wp-polyfill, wp-primitives, wp-server-side-render, wp-url ⚠️
product-best-sellers.js lodash, wc-settings, wp-api-fetch, wp-block-editor, wp-blocks, wp-components, wp-compose, wp-element, wp-escape-html, wp-html-entities, wp-i18n, wp-polyfill, wp-primitives, wp-server-side-render, wp-url ⚠️
product-category.js lodash, wc-settings, wp-api-fetch, wp-block-editor, wp-blocks, wp-components, wp-compose, wp-element, wp-escape-html, wp-html-entities, wp-i18n, wp-polyfill, wp-primitives, wp-server-side-render, wp-url ⚠️
product-categories.js wc-settings, wp-block-editor, wp-blocks, wp-components, wp-compose, wp-element, wp-i18n, wp-polyfill, wp-primitives, wp-server-side-render ⚠️
product-new.js lodash, wc-settings, wp-api-fetch, wp-block-editor, wp-blocks, wp-components, wp-compose, wp-element, wp-escape-html, wp-html-entities, wp-i18n, wp-polyfill, wp-primitives, wp-server-side-render, wp-url ⚠️
product-on-sale.js lodash, wc-settings, wp-api-fetch, wp-block-editor, wp-blocks, wp-components, wp-compose, wp-element, wp-escape-html, wp-html-entities, wp-i18n, wp-polyfill, wp-primitives, wp-server-side-render, wp-url ⚠️
product-top-rated.js lodash, wc-settings, wp-api-fetch, wp-block-editor, wp-blocks, wp-components, wp-compose, wp-element, wp-escape-html, wp-html-entities, wp-i18n, wp-polyfill, wp-primitives, wp-server-side-render, wp-url ⚠️
products-by-attribute.js lodash, wc-settings, wp-api-fetch, wp-block-editor, wp-blocks, wp-components, wp-compose, wp-element, wp-escape-html, wp-html-entities, wp-i18n, wp-polyfill, wp-primitives, wp-server-side-render, wp-url ⚠️
featured-product.js lodash, react, wc-settings, wp-api-fetch, wp-block-editor, wp-blocks, wp-components, wp-compose, wp-data, wp-element, wp-escape-html, wp-html-entities, wp-i18n, wp-is-shallow-equal, wp-polyfill, wp-primitives, wp-url ⚠️
all-reviews.js lodash, react, wc-settings, wp-api-fetch, wp-block-editor, wp-blocks, wp-components, wp-compose, wp-element, wp-escape-html, wp-i18n, wp-is-shallow-equal, wp-polyfill, wp-primitives ⚠️
reviews-by-product.js lodash, react, wc-settings, wp-api-fetch, wp-block-editor, wp-blocks, wp-components, wp-compose, wp-element, wp-escape-html, wp-html-entities, wp-i18n, wp-is-shallow-equal, wp-polyfill, wp-primitives, wp-url ⚠️
reviews-by-category.js lodash, react, wc-settings, wp-api-fetch, wp-block-editor, wp-blocks, wp-components, wp-compose, wp-element, wp-escape-html, wp-html-entities, wp-i18n, wp-is-shallow-equal, wp-polyfill, wp-primitives, wp-url ⚠️
product-search.js wc-settings, wp-block-editor, wp-blocks, wp-components, wp-compose, wp-element, wp-i18n, wp-polyfill, wp-primitives ⚠️
product-tag.js lodash, wc-settings, wp-api-fetch, wp-block-editor, wp-blocks, wp-components, wp-compose, wp-element, wp-html-entities, wp-i18n, wp-polyfill, wp-primitives, wp-server-side-render, wp-url ⚠️
featured-category.js lodash, wc-settings, wp-api-fetch, wp-block-editor, wp-blocks, wp-components, wp-compose, wp-data, wp-element, wp-escape-html, wp-html-entities, wp-i18n, wp-polyfill, wp-primitives, wp-url ⚠️
all-products.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-components, wp-compose, wp-data, wp-deprecated, wp-dom, wp-element, wp-escape-html, wp-hooks, wp-html-entities, wp-i18n, wp-is-shallow-equal, wp-polyfill, wp-primitives, wp-url, wp-warning, wp-wordcount ⚠️
price-filter.js lodash, react, wc-blocks-data-store, wc-price-format, wc-settings, wp-block-editor, wp-blocks, wp-components, wp-compose, wp-data, wp-element, wp-i18n, wp-is-shallow-equal, wp-polyfill, wp-primitives, wp-url ⚠️
attribute-filter.js lodash, react, wc-blocks-data-store, wc-settings, wp-a11y, wp-block-editor, wp-blocks, wp-components, wp-compose, wp-data, wp-element, wp-html-entities, wp-i18n, wp-is-shallow-equal, wp-polyfill, wp-primitives, wp-url ⚠️
stock-filter.js lodash, react, wc-blocks-data-store, wc-settings, wp-a11y, wp-block-editor, wp-blocks, wp-components, wp-compose, wp-data, wp-element, wp-html-entities, wp-i18n, wp-is-shallow-equal, wp-polyfill, wp-primitives ⚠️
active-filters.js lodash, react, wc-blocks-data-store, wc-price-format, wc-settings, wp-block-editor, wp-blocks, wp-components, wp-compose, wp-data, wp-element, wp-html-entities, wp-i18n, wp-is-shallow-equal, wp-polyfill, wp-primitives ⚠️
cart.js lodash, react, wc-blocks-checkout, wc-blocks-data-store, wc-blocks-registry, wc-price-format, wc-settings, wp-a11y, wp-api-fetch, wp-autop, wp-block-editor, wp-blocks, 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-plugins, wp-polyfill, wp-primitives, wp-url, wp-warning, wp-wordcount ⚠️
checkout.js lodash, react, wc-blocks-checkout, wc-blocks-data-store, wc-blocks-registry, wc-price-format, wc-settings, wp-a11y, wp-api-fetch, wp-autop, wp-block-editor, wp-blocks, 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-plugins, wp-polyfill, wp-primitives, wp-url, wp-warning, wp-wordcount ⚠️
mini-cart.js react, wc-price-format, wc-settings, wp-block-editor, wp-blocks, wp-components, wp-dom, wp-element, wp-i18n, wp-polyfill, wp-primitives ⚠️
mini-cart-contents.js lodash, react, wc-blocks-checkout, wc-blocks-data-store, wc-blocks-registry, wc-price-format, wc-settings, wp-a11y, wp-autop, wp-block-editor, wp-blocks, 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 ⚠️
single-product.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-components, wp-compose, wp-data, wp-deprecated, wp-dom, wp-element, wp-escape-html, wp-hooks, wp-html-entities, wp-i18n, wp-is-shallow-equal, wp-polyfill, wp-primitives, wp-url, wp-warning, wp-wordcount ⚠️
legacy-template.js wc-settings, wp-block-editor, wp-blocks, wp-components, wp-element, wp-i18n, wp-polyfill, wp-primitives ⚠️

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

@tjcafferkey
Copy link
Contributor Author

I don't seem to be able to remove the last attribute filter, is that expected?

@Aljullu that's definitely not expected 😅 . I have fixed the crashing component just working on removal of filter now.

…products-block into update/filter-product-by-attribute-php-template
@github-actions
Copy link
Contributor

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
wc-blocks.js wp-blocks, wp-compose, wp-element, wp-hooks, wp-i18n, wp-polyfill, wp-primitives ⚠️
handpicked-products.js lodash, react, wc-settings, wp-api-fetch, wp-block-editor, wp-blocks, wp-components, wp-compose, wp-element, wp-escape-html, wp-html-entities, wp-i18n, wp-polyfill, wp-primitives, wp-server-side-render, wp-url ⚠️
product-best-sellers.js lodash, wc-settings, wp-api-fetch, wp-block-editor, wp-blocks, wp-components, wp-compose, wp-element, wp-escape-html, wp-html-entities, wp-i18n, wp-polyfill, wp-primitives, wp-server-side-render, wp-url ⚠️
product-category.js lodash, wc-settings, wp-api-fetch, wp-block-editor, wp-blocks, wp-components, wp-compose, wp-element, wp-escape-html, wp-html-entities, wp-i18n, wp-polyfill, wp-primitives, wp-server-side-render, wp-url ⚠️
product-categories.js wc-settings, wp-block-editor, wp-blocks, wp-components, wp-compose, wp-element, wp-i18n, wp-polyfill, wp-primitives, wp-server-side-render ⚠️
product-new.js lodash, wc-settings, wp-api-fetch, wp-block-editor, wp-blocks, wp-components, wp-compose, wp-element, wp-escape-html, wp-html-entities, wp-i18n, wp-polyfill, wp-primitives, wp-server-side-render, wp-url ⚠️
product-on-sale.js lodash, wc-settings, wp-api-fetch, wp-block-editor, wp-blocks, wp-components, wp-compose, wp-element, wp-escape-html, wp-html-entities, wp-i18n, wp-polyfill, wp-primitives, wp-server-side-render, wp-url ⚠️
product-top-rated.js lodash, wc-settings, wp-api-fetch, wp-block-editor, wp-blocks, wp-components, wp-compose, wp-element, wp-escape-html, wp-html-entities, wp-i18n, wp-polyfill, wp-primitives, wp-server-side-render, wp-url ⚠️
products-by-attribute.js lodash, wc-settings, wp-api-fetch, wp-block-editor, wp-blocks, wp-components, wp-compose, wp-element, wp-escape-html, wp-html-entities, wp-i18n, wp-polyfill, wp-primitives, wp-server-side-render, wp-url ⚠️
featured-product.js lodash, react, wc-settings, wp-api-fetch, wp-block-editor, wp-blocks, wp-components, wp-compose, wp-data, wp-element, wp-escape-html, wp-html-entities, wp-i18n, wp-is-shallow-equal, wp-polyfill, wp-primitives, wp-url ⚠️
all-reviews.js lodash, react, wc-settings, wp-api-fetch, wp-block-editor, wp-blocks, wp-components, wp-compose, wp-element, wp-escape-html, wp-i18n, wp-is-shallow-equal, wp-polyfill, wp-primitives ⚠️
reviews-by-product.js lodash, react, wc-settings, wp-api-fetch, wp-block-editor, wp-blocks, wp-components, wp-compose, wp-element, wp-escape-html, wp-html-entities, wp-i18n, wp-is-shallow-equal, wp-polyfill, wp-primitives, wp-url ⚠️
reviews-by-category.js lodash, react, wc-settings, wp-api-fetch, wp-block-editor, wp-blocks, wp-components, wp-compose, wp-element, wp-escape-html, wp-html-entities, wp-i18n, wp-is-shallow-equal, wp-polyfill, wp-primitives, wp-url ⚠️
product-search.js wc-settings, wp-block-editor, wp-blocks, wp-components, wp-compose, wp-element, wp-i18n, wp-polyfill, wp-primitives ⚠️
product-tag.js lodash, wc-settings, wp-api-fetch, wp-block-editor, wp-blocks, wp-components, wp-compose, wp-element, wp-html-entities, wp-i18n, wp-polyfill, wp-primitives, wp-server-side-render, wp-url ⚠️
featured-category.js lodash, wc-settings, wp-api-fetch, wp-block-editor, wp-blocks, wp-components, wp-compose, wp-data, wp-element, wp-escape-html, wp-html-entities, wp-i18n, wp-polyfill, wp-primitives, wp-url ⚠️
all-products.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-components, wp-compose, wp-data, wp-deprecated, wp-dom, wp-element, wp-escape-html, wp-hooks, wp-html-entities, wp-i18n, wp-is-shallow-equal, wp-polyfill, wp-primitives, wp-url, wp-warning, wp-wordcount ⚠️
price-filter.js lodash, react, wc-blocks-data-store, wc-price-format, wc-settings, wp-block-editor, wp-blocks, wp-components, wp-compose, wp-data, wp-element, wp-i18n, wp-is-shallow-equal, wp-polyfill, wp-primitives, wp-url ⚠️
attribute-filter.js lodash, react, wc-blocks-data-store, wc-settings, wp-a11y, wp-block-editor, wp-blocks, wp-components, wp-compose, wp-data, wp-element, wp-html-entities, wp-i18n, wp-is-shallow-equal, wp-polyfill, wp-primitives, wp-url ⚠️
stock-filter.js lodash, react, wc-blocks-data-store, wc-settings, wp-a11y, wp-block-editor, wp-blocks, wp-components, wp-compose, wp-data, wp-element, wp-html-entities, wp-i18n, wp-is-shallow-equal, wp-polyfill, wp-primitives ⚠️
active-filters.js lodash, react, wc-blocks-data-store, wc-price-format, wc-settings, wp-block-editor, wp-blocks, wp-components, wp-compose, wp-data, wp-element, wp-html-entities, wp-i18n, wp-is-shallow-equal, wp-polyfill, wp-primitives ⚠️
cart.js lodash, react, wc-blocks-checkout, wc-blocks-data-store, wc-blocks-registry, wc-price-format, wc-settings, wp-a11y, wp-api-fetch, wp-autop, wp-block-editor, wp-blocks, 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-plugins, wp-polyfill, wp-primitives, wp-url, wp-warning, wp-wordcount ⚠️
checkout.js lodash, react, wc-blocks-checkout, wc-blocks-data-store, wc-blocks-registry, wc-price-format, wc-settings, wp-a11y, wp-api-fetch, wp-autop, wp-block-editor, wp-blocks, 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-plugins, wp-polyfill, wp-primitives, wp-url, wp-warning, wp-wordcount ⚠️
mini-cart.js react, wc-price-format, wc-settings, wp-block-editor, wp-blocks, wp-components, wp-dom, wp-element, wp-i18n, wp-polyfill, wp-primitives ⚠️
mini-cart-contents.js lodash, react, wc-blocks-checkout, wc-blocks-data-store, wc-blocks-registry, wc-price-format, wc-settings, wp-a11y, wp-autop, wp-block-editor, wp-blocks, 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 ⚠️
single-product.js lodash, react, wc-blocks-data-store, wc-blocks-registry, wc-blocks-shared-context, wc-blocks-shared-hocs, wc-price-format, wc-settings, wp-api-fetch, wp-autop, wp-block-editor, wp-blocks, wp-components, wp-compose, wp-data, wp-deprecated, wp-dom, wp-element, wp-escape-html, wp-hooks, wp-html-entities, wp-i18n, wp-is-shallow-equal, wp-polyfill, wp-primitives, wp-url, wp-warning, wp-wordcount ⚠️
legacy-template.js wc-settings, wp-block-editor, wp-blocks, wp-components, wp-element, wp-i18n, wp-polyfill, wp-primitives ⚠️

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

@github-actions
Copy link
Contributor

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
attribute-filter.js wp-url ⚠️

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

@github-actions
Copy link
Contributor

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
attribute-filter.js wp-url ⚠️

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

@gigitux
Copy link
Contributor

gigitux commented Apr 11, 2022

I updated this PR with the fix for removing the filter. I noticed other three bugs:

  • when the user is on page 2 (so the base url was /shop/page/{number_page}) and applied a filter, the generated URL was shop/page/2/?filter_color=gray&query_type_color=and and WordPress returned a 404 error.
  • The system always queried for AND, never for OR.
  • The request to the endpoint returned attributes for the hidden product too. The archive product shows only the product visible, so I updated the request.

This task was pretty trickier, I hope that I didn't introduce new bugs :D

@gigitux gigitux requested a review from Aljullu April 11, 2022 15:41
Copy link
Contributor

@Aljullu Aljullu left a comment

Choose a reason for hiding this comment

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

I'm facing a strange issue when I add two Attribute Filter blocks in the page and one has Query Type: AND and the other one Query Type: OR, the page enters an infinite reloading loop. Can you reproduce as well?

@gigitux
Copy link
Contributor

gigitux commented Apr 12, 2022

I'm facing a strange issue when I add two Attribute Filter blocks in the page and one has Query Type: AND and the other one Query Type: OR, the page enters an infinite reloading loop. Can you reproduce as well?

Yes, thanks for catching this! I'm working on a fix!

@gigitux gigitux force-pushed the update/filter-product-by-attribute-php-template branch from f5a4ff9 to 0bdf8a7 Compare April 12, 2022 15:57
@gigitux
Copy link
Contributor

gigitux commented Apr 12, 2022

Fixed with 0bdf8a7

@gigitux gigitux requested a review from Aljullu April 12, 2022 15:59
@github-actions
Copy link
Contributor

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
attribute-filter.js wp-url ⚠️

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

2 similar comments
@github-actions
Copy link
Contributor

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
attribute-filter.js wp-url ⚠️

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

@github-actions
Copy link
Contributor

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
attribute-filter.js wp-url ⚠️

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

@tjcafferkey tjcafferkey requested a review from albarin April 13, 2022 10:52
…products-block into update/filter-product-by-attribute-php-template
@github-actions
Copy link
Contributor

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
attribute-filter.js wp-url ⚠️

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

@github-actions
Copy link
Contributor

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
attribute-filter.js wp-url ⚠️

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

@gigitux gigitux merged commit 520997b into trunk Apr 14, 2022
@gigitux gigitux deleted the update/filter-product-by-attribute-php-template branch April 14, 2022 12:38
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
block: filter by attribute Issues related to the Filter by Attribute block. type: enhancement The issue is a request for an enhancement.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Make Filter Products by Attribute work with PHP templates
4 participants