Skip to content
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

Conversation

imanish003
Copy link
Contributor

@imanish003 imanish003 commented May 16, 2024

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

  1. Make sure that following checkbox isn't ticked in WooCommerce settings
    image

  2. 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:

  1. Insert a Product Collection block into the Product Catalog template & save the template.

    • Verify that "Sync with current query" toggle is ON in inspector control for Product Collection block.
    • Verify that out-of-stock products are visible in Product Collection block
  2. Check the checkbox & save (Make sure it isn't checked when Product Collection block was inserted in 1st step):
    image

  3. Refresh the Product Catalog template in the Editor.

    • Verify that out-of-stock products aren't visible in Editor anymore.
  4. Save and go to frontend. Verify that out-of-stock products aren't visible on Frontend too.

Changelog entry

  • Automatically create a changelog entry from the details below.

Significance

  • Patch
  • Minor
  • Major

Type

  • Fix - Fixes an existing bug
  • Add - Adds functionality
  • Update - Update existing functionality
  • Dev - Development related task
  • Tweak - A minor adjustment to the codebase
  • Performance - Address performance issues
  • Enhancement - Improvement to existing functionality

Message

Fix: Product Collection block should respects 'Out of stock visibility' setting

Comment

…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.
@imanish003 imanish003 changed the title Fix: Ensure Product Collection Block Respects "Hide Out of Stock Item… Fix: Product Collection Block Respects 'Out of stock visibility' Setting May 16, 2024
@imanish003 imanish003 added type: bug The issue is a confirmed bug. team: Kirigami & Origami focus: FSE Issues related to Full Site Editing block: product collection Issues related to the Product Collection block labels May 16, 2024
Copy link
Contributor

github-actions bot commented May 16, 2024

Test using WordPress Playground

The changes in this pull request can be previewed and tested using a WordPress Playground instance.
WordPress Playground is an experimental project that creates a full WordPress instance entirely within the browser.

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.

@imanish003 imanish003 closed this May 16, 2024
@imanish003 imanish003 reopened this May 16, 2024
@github-actions github-actions bot added the plugin: woocommerce Issues related to the WooCommerce Core plugin. label May 16, 2024
@imanish003 imanish003 marked this pull request as ready for review May 16, 2024 09:46
@imanish003 imanish003 changed the title Fix: Product Collection Block Respects 'Out of stock visibility' Setting Fix: Product Collection block should respects 'Out of stock visibility' setting May 16, 2024
@woocommercebot woocommercebot requested review from a team and nefeline and removed request for a team May 16, 2024 09:49
@imanish003 imanish003 requested a review from kmanijak May 16, 2024 09:49
Copy link
Contributor

github-actions bot commented May 16, 2024

Hi @nefeline, @kmanijak,

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:
https://github.com/woocommerce/woocommerce/wiki/Writing-high-quality-testing-instructions

Copy link
Contributor

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:
https://github.com/woocommerce/woocommerce/wiki/Writing-high-quality-testing-instructions

Copy link
Contributor

@kmanijak kmanijak left a 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! 🚀

@imanish003 imanish003 merged commit 3a3a386 into trunk May 21, 2024
49 checks passed
@imanish003 imanish003 deleted the fix/47536-product-collection-out-of-stock-products-still-visible-despite-hide-out-of-stock-items-setting branch May 21, 2024 05:20
@github-actions github-actions bot added this to the 9.0.0 milestone May 21, 2024
@github-actions github-actions bot added the needs: analysis Indicates if the PR requires a PR testing scrub session. label May 21, 2024
@rodelgc rodelgc added status: analysis complete Indicates if a PR has been analysed by Solaris needs: external testing Indicates if the PR requires further testing conducted by testers external to the development team. and removed needs: analysis Indicates if the PR requires a PR testing scrub session. labels May 22, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
block: product collection Issues related to the Product Collection block focus: FSE Issues related to Full Site Editing needs: external testing Indicates if the PR requires further testing conducted by testers external to the development team. plugin: woocommerce Issues related to the WooCommerce Core plugin. status: analysis complete Indicates if a PR has been analysed by Solaris team: Kirigami & Origami type: bug The issue is a confirmed bug.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Product Collection: Out-of-Stock Products Still Visible Despite 'Hide Out of Stock Items' Setting
3 participants