* Fix incorrect count for brands through the /wp-json/wc/v3/products/brands endpoint - Changed product_brand taxonomy to use _wc_term_recount instead of _update_post_term_count - Added product_brand to the valid taxonomies in wc_change_term_counts filter - This ensures brand counts properly account for WooCommerce product visibility logic * Fix brand count test to respect product visibility settings - Use go_to() to simulate frontend context instead of admin context - Use get_terms() instead of get_term() to trigger wc_change_term_counts filter - Test now properly validates that brand counts respect 'hide out of stock items' setting * Add comprehensive brand count tests for admin and frontend contexts - Add test_brand_count_respects_product_visibility() that uses go_to() and get_terms() to simulate frontend behavior - Add test_brand_count_ignores_product_visibility_in_admin_context() that uses get_term() to simulate admin behavior - Tests demonstrate different behaviors: frontend respects out-of-stock settings, admin ignores them - Both tests pass and provide complete coverage of the context-dependent behavior * Add REST API brands controller test file - Add comprehensive test suite for WC_REST_Product_Brands_Controller - Tests cover brand listing, count accuracy, product visibility respect - Includes test for brand counts respecting out-of-stock product settings - All 5 tests pass with 29 assertions - Provides end-to-end testing of brands API functionality * Remove admin vs frontend context documentation from woo-phpunit rule The context-dependent behavior documentation was removed as it was found to be inaccurate: - is_admin() returns false in test environment, not true - The real issue is function choice (get_terms vs get_term), not context - Simplified rule to focus on core testing practices * Remove duplicate product_brand filter from WC_Brands class * Add changefile(s) from automation for the following project(s): woocommerce * Delete plugins/woocommerce/changelog/fix-wooplug-5231-incorrect-count-for-brands-through-the-wp Remove superfluous changelog added by AI. * update brands rest controller test to remove unnecessary setup * Update doc block for method to include Brands * Add test for deleting product a brand is attached to. * Simplify the tests with helper for getting first brand term. * Add test for visibility affected count on specific brand REST request. * Move tests to category controller. The brands controller extends the category controller so this ensures tests live in the appropriate place. As a part of this refactor I also improved some of the test architecture and removed superfluous term_cache clears (WP scaffolding already clears caches on tearDown). --------- Co-authored-by: github-actions <github-actions@github.com> |
||
---|---|---|
.cursor/rules | ||
.github | ||
.husky | ||
bin | ||
docs | ||
packages | ||
plugins | ||
tools | ||
.codecov.yml | ||
.coderabbit.yml | ||
.editorconfig | ||
.eslintignore | ||
.eslintrc.js | ||
.gitattributes | ||
.gitignore | ||
.markdownlint.json | ||
.markdownlintignore | ||
.npmrc | ||
.nvmrc | ||
.pnpmfile.cjs | ||
.prettierrc.js | ||
.stylelintrc | ||
.syncpackrc | ||
changelog.txt | ||
CODE_OF_CONDUCT.md | ||
CODEOWNERS | ||
DEVELOPMENT.md | ||
package.json | ||
phpcs.xml | ||
pnpm-lock.yaml | ||
pnpm-workspace.yaml | ||
README.md | ||
renovate.json | ||
SECURITY.md | ||
tsconfig.base.json |
WooCommerce Monorepo
Welcome to the WooCommerce Monorepo on GitHub. Here you can find all of the plugins, packages, and tools used in the development of the core WooCommerce plugin as well as WooCommerce extensions. You can browse the source, look at open issues, contribute code, and keep tracking of ongoing development.
We recommend all developers to follow the WooCommerce development blog to stay up to date about everything happening in the project. You can also follow @DevelopWoo on X (formerly Twitter) for the latest development updates.
Getting Started
To get up and running within the WooCommerce Monorepo, you will need to make sure that you have installed all of the prerequisites.
Prerequisites
- NVM: While you can always install Node through other means, we recommend using NVM to ensure you're aligned with the version used by our development teams. Our repository contains an
.nvmrc
file which helps ensure you are using the correct version of Node. - PNPM: Our repository utilizes PNPM to manage project dependencies and run various scripts involved in building and testing projects.
- PHP 7.4+: WooCommerce Core currently features a minimum PHP version of 7.4. It is also needed to run Composer and various project build scripts. See troubleshooting for troubleshooting problems installing PHP.
- Composer: We use Composer to manage all of the dependencies for PHP packages and plugins.
Note: A POSIX compliant operating system (e.g., Linux, macOS) is assumed. If you're working on a Windows machine, the recommended approach is to use WSL (available since Windows 10).
Once you've installed all of the prerequisites, the following will prepare all of the build outputs necessary for development:
# Ensure that correct version of Node is installed and being used
nvm install
# Install the PHP and Composer dependencies for all of the plugins, packages, and tools
pnpm install -frozen-lockfile
# Build all of the plugins, packages, and tools in the monorepo
pnpm build
Repository Structure
Each plugin, package, and tool has its own package.json
file containing project-specific dependencies and scripts. Most projects also contain a README.md
file with any project-specific setup instructions and documentation.
- Plugins: Our repository contains plugins that relate to or otherwise aid in the development of WooCommerce.
- WooCommerce Core: The core WooCommerce plugin is available in the plugins directory.
- Packages: Contained within the packages directory are all of the PHP and JavaScript provided for the community. Some of these are internal dependencies and are marked with an
internal-
prefix. - Tools: We also have a growing number of tools within our repository. Many of these are intended to be utilities and scripts for use in the monorepo, but, this directory may also contain external tools.
If you'd like to learn more about how our monorepo works, please check out this guide here.
Reporting Security Issues
To disclose a security issue to our team, please submit a report via HackerOne here.
Support
This repository is not suitable for support. Please don't use our issue tracker for support requests, but for core WooCommerce issues only. Support can take place through the appropriate channels:
- If you have a problem, you may want to start with the self help guide.
- The WooCommerce.com premium support portal for customers who have purchased themes or extensions.
- Our community forum on wp.org which is available for all WooCommerce users.
- The Official WooCommerce Facebook Group.
- For customizations, you may want to check our list of WooExperts or Codeable.
NOTE: Unfortunately, we are unable to honor support requests in issues on this repository; as a result, any requests submitted in this manner will be closed.
Community
For peer to peer support, real-time announcements, and office hours, please join our slack community!
Contributing to WooCommerce
As an open source project, we rely on community contributions to continue to improve WooCommerce. To contribute, please follow the pre-requisites above and visit our Contributing to Woo doc for more links and contribution guidelines.