[Backport to release/11.1] Include product brands in term recounts - #67656
Conversation
* Include product brands in term recounts * Add changelog for product brand recounts
Testing GuidelinesHi @gigitux , Apart from reviewing the code changes, please make sure to review the testing instructions (Guide) and verify that relevant tests (E2E, Unit, Integration, etc.) have been added or updated as needed. Reminder: PR reviewers are required to document testing performed. This includes:
|
Test using WordPress PlaygroundThe changes in this pull request can be previewed and tested using a WordPress Playground instance. Test this pull request with WordPress Playground. Note that this URL is valid for 30 days from when this comment was last updated. You can update it by closing/reopening the PR or pushing a commit that changes plugin code. |
This PR is a cherry-pick of #67630 to
release/11.1.Original PR Description
Submission Review Guidelines:
Changes proposed in this Pull Request:
Product brands currently maintain visibility-aware term counts through separate
WC_Brandscallbacks. This means callers of the shared WooCommerce recount functions update product categories and tags but can leave brand counts stale. It also makes normal stock and inventory-setting updates run a second, Brands-only recount after the shared recount.This PR:
product_brandin the deferred stock recount path;wc_recount_all_terms();_wc_recount_terms_by_product();The existing public
WC_Brands::recount_after_stock_change()andWC_Brands::recount_all_brands()methods remain unchanged for direct callers.I found this opportunity, while I was working on #67624.
How to test the changes in this Pull Request:
1.0.1.Milestone
Automatically assign milestone for the next WooCommerce versionChangelog entry
A patch/fix changelog entry was created manually at
plugins/woocommerce/changelog/fix-product-brand-term-recounts.Release Communication
Select if this PR needs a generated summary for release notes:
Use of AI Tools
OpenAI Codex was used to implement the changes, extend the tests, run validation, and draft this pull request description. The contributor remains responsible for reviewing and maintaining the submitted code.