-
Notifications
You must be signed in to change notification settings - Fork 10.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix: Product Collection block should respects 'Out of stock visibility' setting #47537
Fix: Product Collection block should respects 'Out of stock visibility' setting #47537
Conversation
…s" Setting - Added logic to include the "Out of stock visibility" setting in the Product Collection block. - Modified `ProductTemplateEdit` component to use the `getDefaultStockStatuses` function. - Ensured that out-of-stock products are hidden in the Product Collection block when the "Hide out of stock items from the catalog" option is enabled.
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 new commit. |
Apart from reviewing the code changes, please make sure to review the testing instructions as well. You can follow this guide to find out what good testing instructions should look like: |
Hi @nefeline, Apart from reviewing the code changes, please make sure to review the testing instructions as well. You can follow this guide to find out what good testing instructions should look like: |
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.
Is tests well! Thanks for taking care of it! 🚀
Changes proposed in this Pull Request:
I updated the logic to always use "Out of stock visibility" setting, whenever "Sync with current query" toggle is ON in inspector control of Product Collection block. This ensures that out-of-stock products are hidden in the Product Collection block on Editor side when the "Hide out of stock items from the catalog" option is enabled.
For more info about the issue, see: #47536
Closes #47536
How to test the changes in this Pull Request:
Prerequisite
Make sure that following checkbox isn't ticked in WooCommerce settings
Ensure the presence of some out-of-stock products. If possible, rename an out-of-stock product to "1st product" to show it as 1st product in grid.
Steps:
Insert a Product Collection block into the Product Catalog template & save the template.
Check the checkbox & save (Make sure it isn't checked when Product Collection block was inserted in 1st step):
Refresh the Product Catalog template in the Editor.
Save and go to frontend. Verify that out-of-stock products aren't visible on Frontend too.
Changelog entry
Significance
Type
Message
Fix: Product Collection block should respects 'Out of stock visibility' setting
Comment