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

Fixed a bug with swatches shown even for out-of-stock variants #10

Merged

Conversation

empiricompany
Copy link
Contributor

@empiricompany empiricompany commented Aug 21, 2024

Description (*)

In the product list, all swatches are always shown even if they are not available.
You can verify this on the PDP because only the available ones are displayed correctly.

Tested with both enabled and disabled stock inventory configuration "Display Out of Stock Products"

inventory_settings

When "Display Out of Stock Products" is enabled shown correctly like this:
show_out_of_stock

When "Display Out of Stock Products" is disabled all swatches are always shown even if they are not available.
With this patch shown correctly like this:

not_out_of_stock

The bug occurs when the " Display Out of Stock Products" configuration is disabled.

Related Pull Requests

OpenMage/magento-lts#4100

Fixed Issues (if relevant)

OpenMage/magento-lts#3527

Manual testing scenarios (*)

  1. Create configurable product with options as swatch such as color
  2. Set stock unavailable for one color option

Example with sample data:

  1. In product configurable Name: "Nolita cami" SKU "wbk000c" set all children products with color pink unavailable.

In the product list, all colors are always shown even if they are not available.
You can verify this on the PDP because only the available ones are displayed correctly.

pdp
pl

Questions or comments

Contribution checklist (*)

  • Pull request has a meaningful description of its purpose
  • All commits are accompanied by meaningful commit messages
  • All automated tests passed successfully (all builds are green)
  • Add yourself to contributors list

@fballiano
Copy link
Contributor

the first PR ❤️!

@fballiano
Copy link
Contributor

I was wondering of this would impact websites that do not use stock levels, but as far as I can see this filter is used in many places in the core, without checking if the stock is enabled or not

Screenshot 2024-08-21 alle 09 45 38

so I think it should be safe to merge

@fballiano
Copy link
Contributor

will make a couple of test and merge ASAP

@fballiano
Copy link
Contributor

  • tested on products with stock enabled
  • tested on products where only some simple have stock enabled and some don't

all situations work, so for me it's a yes

@fballiano fballiano changed the title In product list all swatches are always shown even if they are not available when "Display Out of Stock Products" is disabled Fixed a bug with swatches shown even for out-of-stock variants Aug 21, 2024
@fballiano fballiano merged commit 75de337 into MahoCommerce:main Aug 21, 2024
11 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants