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

Product Query: extend the Query Loop block with capabilities for more specific queries #6795

Closed
Tracked by #42616
sunyatasattva opened this issue Jul 29, 2022 · 1 comment
Labels
block-type: product-grid Issues related to/affecting all product-grid type blocks. focus: FSE Work related to prepare WooCommerce for FSE. type: enhancement The issue is a request for an enhancement.

Comments

@sunyatasattva
Copy link
Contributor

The Query Loop block will need to be extended in such a way as to enable WooCommerce-specific attributes to be passed, to create custom and versatile queries.

Our current proposal is to hook in the blocks.registerBlockType filter to add some custom attributes. Since attributes can't be added through this method to specific variations, such attributes should be namespaced, in order to reduce pollution of the core block as much as possible. Something like __woocommerceQuery should contain said custom attributes. For the POC, we are aiming to support at least one custom query (for example, all products on sale), so, the following attributes are required:

  1. A variationName attribute will be used to define different variation names, allowing for easier variation detection, and also for conditionally showing or hiding certain settings depending on the specific variation.
  2. An attribute representing a common query we want to implement, e.g. showOnlyProductsOnSale.

Later, by hooking in the editor.BlockEdit filter for core/query we can conditionally extend the settings via a HOC to add controls for those attributes.

Specific variations of the block will be implemented as to reduce cognitive overhead for the merchant, by allowing the most common query types to be presets.

We will likely need to implement a BlockVariationController extending the AbstractBlock class to handle block variation registration in our repo (Slack link: 1655812065.438279-slack-C02UBB1EPEF).

@sunyatasattva sunyatasattva added type: enhancement The issue is a request for an enhancement. block-type: product-grid Issues related to/affecting all product-grid type blocks. focus: FSE Work related to prepare WooCommerce for FSE. labels Jul 29, 2022
@gigitux gigitux changed the title Product Grid: extend the Query Loop block with capabilities for more specific queries Product Query: extend the Query Loop block with capabilities for more specific queries Aug 5, 2022
@sunyatasattva
Copy link
Contributor Author

This was closed in #6812, WordPress/gutenberg#44093 and WordPress/gutenberg#43590

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
block-type: product-grid Issues related to/affecting all product-grid type blocks. focus: FSE Work related to prepare WooCommerce for FSE. type: enhancement The issue is a request for an enhancement.
Projects
None yet
Development

No branches or pull requests

1 participant