a73c6e5546
* Allow registering custom collections with various context references Implemented the registration of product collections with different context references using the `usesReference` property. These custom collections are now registered with specific contexts such as product, cart, order, and archive. This enhancement allows for more tailored previews and functionality based on the specific context in which the product collection is used. * Add changefile(s) from automation for the following project(s): woocommerce-blocks * Support multiple references for usesReference * docs: update documentation to include `usesReference` Enhanced the `register-product-collection` documentation to include details about the new `usesReference` property. This property allows collections to specify required references, enhancing their contextual relevance and preview capabilities. - Added `usesReference` description to the collection fields section. - Included examples demonstrating the usage of `usesReference` with single and multiple references. - Clarified the behavior when required references are unavailable on the editor side but available on the frontend. This documentation update provides third-party developers with the necessary information to utilize the `usesReference` property effectively in their custom product collections. * test: add e2e tests for `usesReference` Added end-to-end tests to verify the functionality of the `usesReference` property in product collections. These tests ensure that the appropriate preview labels are displayed. - Created multiple custom product collections with different `usesReference` values: `product`, `cart`, `order`, `archive`, and combinations of these. - Verified that collections show the correct preview label when the required reference is present. - Ensured that the preview label is not shown in irrelevant contexts, such as posts or product catalog templates. This addition enhances test coverage and ensures the robustness of the `usesReference` feature. * Fixed issue with preview label showing in Specific Product and Archive templates. * Handle cases when termId or productId is 0 This also improves the readability of the code by using better variable names. * Make PC use postId context so location can be recognised correctly (#50152) * Fix TS errors --------- Co-authored-by: github-actions <github-actions@github.com> Co-authored-by: Karol Manijak <20098064+kmanijak@users.noreply.github.com> |
||
---|---|---|
.. | ||
.vscode | ||
assets | ||
bin | ||
docs | ||
packages | ||
storybook | ||
tests | ||
.distignore | ||
.editorconfig | ||
.env | ||
.eslintignore | ||
.eslintrc.js | ||
.gitattributes | ||
.gitignore | ||
.markdownlint.json | ||
.markdownlintignore | ||
.prettierignore | ||
.prettierrc.js | ||
.stylelintrc.json | ||
.wp-env.json | ||
LICENSE | ||
README.md | ||
babel.config.js | ||
composer.json | ||
composer.lock | ||
docker-compose.yml | ||
global.d.ts | ||
package.json | ||
phpcs.xml | ||
phpunit.xml.dist | ||
postcss.config.js | ||
readme.txt | ||
tsconfig.base.json | ||
tsconfig.json | ||
webpack.config.js | ||
wp-cli.yml |
README.md
WooCommerce Blocks
This is the client for WooCommerce + Gutenberg. This package serves as a space to iterate and explore new Blocks and updates to existing blocks for WooCommerce, and how WooCommerce might work with the Block Editor.
Table of Contents
Documentation
To find out more about the blocks and how to use them, check out the documentation on WooCommerce.com.
If you want to see what we're working on for future versions, or want to help out, read on.
Code Documentation
- Blocks - Documentation for specific Blocks.
- Editor Components - Shared components used in WooCommerce blocks for the editor (Gutenberg) UI.
- WooCommerce Blocks Handbook - Documentation for designers and developers on how to extend or contribute to blocks, and how internal developers should handle new releases.
- WooCommerce Blocks Storybook - Contains a list and demo of components used in the plugin.
Getting started with block development
Run through the "Writing Your First Block Type" tutorial for a quick course in block-building.
For deeper dive, try looking at the core blocks code, or see what components are available.
Other useful docs to explore:
Long-term vision
WooCommerce Blocks are the easiest, most flexible way to build your store's user interface and showcase your products.