This article provides a patch for the known Magento Commerce 2.2.2 issue related to the configurable product swatches being out of stock not displayed as crossed out on the store front.
When you have a configurable product and for certain combination of options the related simple product is out of stock, the swatch is still available and can be selected on the store front.
Steps to reproduce:
- In the Magento Admin, create a configurable product with options for two attributes: color(red, black) and size (S,M,L).
- Set Quantity as "1" for each corresponding simple product.
- On the store front, add red,M product to cart and checkout.
- In the Admin, process the order so that the item quantity is updated to "0".
- Make sure backorders are not allowed.
- On the store front, navigate to the same product page and select the same options: red, M.
The red,M swatch has a red slash and cannot selected.
The red,M swatch can be selected.
The patch is attached to this article. To download it, scroll down to the end of the article and click the file name, or click the following link:
Compatible Magento versions:
The patch was created for:
- Magento Commerce 2.2.2
The patch is also compatible (but might not solve the issue) with the following Magento versions and editions:
- Magento Commerce, Magento Commerce Cloud
How to apply the patch
We strongly recommend applying and testing the patch on the Integration/Staging environment, before applying it Production. We also recommend to have a recent backup before any manipulations.
How to apply this patch for Magento Commerce Cloud
- If you do not have a directory named
m2-hotfixesin the project root, please create one.
- Copy the MDVA-8215_EE_2.2.2_v1.composer.patch file to the
Add, commit, and push your code changes:
git add -A && git commit -m "Apply patch MDVA-8215_EE_2.2.2_v1.composer.patch" && git push origin
How to apply this patch for Magento Commerce
- Upload the patch to your Magento root directory.
- Run the following SSH command:
(If the above command does not work, try using
patch -p1 < MDVA-8215_EE_2.2.2_v1.composer.patch
- For the changes to be reflected, refresh the cache in the Admin under System > Cache Management.