This repository has been archived by the owner on Feb 23, 2024. It is now read-only.
Hide categories with 0 products from the Product Categories block #3765
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
ralucaStan
added
status: needs review
type: bug
The issue/PR concerns a confirmed bug.
focus: blocks
Specific work involving or impacting how blocks behave.
block-type: product
Issues related to/affecting all blocks related to products.
labels
Jan 29, 2021
Size Change: 0 B Total Size: 1.18 MB ℹ️ View Unchanged
|
Aljullu
approved these changes
Jan 29, 2021
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is testing great! I needed to Recount terms (inside WooCommerce > Status > Tools) in some occasions to make sure the value of $category->count
was up to date. But after doing that, all categories with only hidden products weren't shown. 👌
LGTM
github-actions
bot
added
status: ready to merge
and removed
status: needs review
labels
Jan 29, 2021
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Labels
block-type: product
Issues related to/affecting all blocks related to products.
focus: blocks
Specific work involving or impacting how blocks behave.
type: bug
The issue/PR concerns a confirmed bug.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This PR adds a check so that empty categories are not displayed in the Product Categories list when the "Show empty categories" block setting is false.
Partially fixes #3564
A new issue has also been submitted to WooCommerce.
How to test the changes in this Pull Request:
While following the reproduction steps from #3564 we noticed that WooCommerce does not remove from a category a product that has been marked as hidden and assigned to a category in the same Update call. So the block receives the category as one with products. See WooCommerce Issue for more details.
In order to test, please follow these steps instead:
Changelog