3c0463ada1
* Introduce the new get_attribute_and_meta_counts method. * Ensure that if no term_slug or term_id is found for counting, the default list with all terms (with count equal zero) is returned instead. * update conditional for the slug, the empty state for requests without filter attributes and the condition query for 'and' * Introduce the get_terms_list method. * Remove the legacy get_attribute_counts method and update its calls to rely on the new get_attribute_and_meta_counts method instead. * Update the query to ensure that if a parent product has multiple identical attributes, they are counted once. * Update to start relying on the get_product_by_metas method for counting product metas * Add a new where_clause to only include product metas and attributes in the macro query if they are not empty. * Add wpdb->prepare to the macro query and the get_terms_list method. * Replace the raw atomic query for fetching the filtered terms with the new get_product_by_filtered_terms method. * Update the request params for the get_attribute_and_meta_counts method. * Update the request params for the product metas (min and max price). * Update the query and returned value on get_terms_list. * Update the validation for returning the default counts when no values are filtered. * Update the query on get_terms_list to use ->prefix * Update the variable for the query to rely on the filtered one. Update the min_price and max_price format on get_product_by_metas. * Ensure the get_product_by_filtered_terms method is triggered for each one of the filtered terms and update the macro query to include those term ids on the WHERE clause. * Make adjustments for the 'and' condition to work as expected. * Ensure the queryState.attributes is properly added as a param to the API request to correctly fetch the attribute count data. * Ensure the get_product_by_metas method is only triggered when at least one of the metas in the request is not empty. * Join type update: for the 'and' (all) filter condition, items with the count zero are not displayed. * wpdb prepare the where clauses * Update the get_product_by_filtered_terms query wpdb prepare params * update the get_product_by_metas method's where clause preparation. * Update the where clause preparation for get_attribute_and_meta_counts so we don't rely on interpolated variables anymore. * Adjust the get_attribute_and_meta_counts method for usage alongside the rating filter. * Adjust the query for fetching the attribute counts for filtered ratings. * Add support for the filter by stock. * Ensure the product attribute counts are correct if the parent product receives a rating. * Ensure product_or_parent_id is used only when the filter by rating is used, not affecting price or stock filters. * Add the missing else condition. * Enable caching. * Address CR * Update query for average rating. * remove file accidentally commited. * When multiple ratings are selected, make sure the where clause is updated accordingly for each one of them. * Start updating the stock_status logic to account for when multiple options are selected by the user. * Ensure the counts are properly updated when more than one stock status is selected. * Ditch the is_array condition for the average_rating counts as is always an array. * Deprecate the second param attributes for the get_attribute_counts method. * Add the filtered_attribute to the transient_key * Bypass cache if WP_DEBUG is enabled. * Update formatting for macro query. * Fix mixed tabs spaces on query * Update spacing/formatting for SQL queries. * Minor: update indentation for the main SQL query --------- Co-authored-by: roykho <roykho77@gmail.com> |
||
---|---|---|
.. | ||
.github | ||
.sources | ||
.vscode | ||
.wordpress-org | ||
assets | ||
bin | ||
docs | ||
images | ||
packages | ||
patches | ||
patterns | ||
src | ||
storybook | ||
templates | ||
tests | ||
.distignore | ||
.editorconfig | ||
.env | ||
.eslintignore | ||
.eslintrc.js | ||
.gitattributes | ||
.gitignore | ||
.markdownlint.json | ||
.markdownlintignore | ||
.nvmrc | ||
.prettierignore | ||
.prettierrc.js | ||
.stylelintrc.json | ||
.wp-env.json | ||
LICENSE | ||
README.md | ||
babel.config.js | ||
checkstyle.xml | ||
composer.json | ||
composer.lock | ||
docker-compose.yml | ||
global.d.ts | ||
package-lock.json | ||
package.json | ||
phpcs.xml | ||
phpunit.xml.dist | ||
postcss.config.js | ||
readme.txt | ||
tsconfig.base.json | ||
tsconfig.json | ||
webpack.config.js | ||
woocommerce-gutenberg-products-block.php |
README.md
WooCommerce Blocks
This is the feature plugin for WooCommerce + Gutenberg. This plugin 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.
Use this plugin if you want access to the bleeding edge of available blocks for WooCommerce. However, stable blocks are bundled into WooCommerce, and can be added from the "WooCommerce" section in the block inserter.
Table of Contents
- Documentation
- Installing the plugin version
- Installing the development version
- Getting started with block development
- Long-term vision
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.
Installing the plugin version
We release a new version of WooCommerce Blocks onto WordPress.org every few weeks, which can be used as an easier way to preview the features.
Note: The plugin follows a policy of supporting the "L0" strategy for version support. What this means is that the plugin will require the most recent version of WordPress, and the most recent version of WooCommerce core at the time of a release. You can read more about this policy here.
- Make sure you have the latest available versions of WordPress and WooCommerce on your site.
- The plugin version is available on WordPress.org. Download the plugin version here.
- Activate the plugin.
Installing the development version
- Make sure you have the latest versions of WordPress and WooCommerce on your site.
- Get a copy of this plugin using the green "Clone or download" button on the right.
- Make sure you're using Node.js v16.
npm install
to install the dependencies.composer install
to install core dependencies.- To compile the code, run any of the following commands
npm run build
(production build).npm run dev
(development build).npm start
(development build + watching for changes).
- Activate the plugin.
The source code is in the assets/
folder and the compiled code is built into build/
.
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.
To begin contributing to the WooCommerce Blocks plugin, see our getting started guide and developer handbook.
Other useful docs to explore:
Long-term vision
WooCommerce Blocks are the easiest, most flexible way to build your store user interface and showcase your products.