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

2.2.6 CE Buying the last of a simple product does not clean parent configurable product cache #19043

Closed
AndrewPenry opened this issue Nov 2, 2018 · 19 comments
Assignees
Labels
Component: ConfigurableProduct Fixed in 2.4.x The issue has been fixed in 2.4-develop branch Issue: Confirmed Gate 3 Passed. Manual verification of the issue completed. Issue is confirmed Priority: P2 A defect with this priority could have functionality issues which are not to expectations. Progress: done Reproduced on 2.2.x The issue has been reproduced on latest 2.2 release Reproduced on 2.3.x The issue has been reproduced on latest 2.3 release Severity: S2 Major restrictions or short-term circumventions are required until a fix is available.

Comments

@AndrewPenry
Copy link

When a user purchases the last of a simple product, even though the quantity is reduced to zero, the option is not disabled until the cache is manually flushed.

Preconditions (*)

  1. Magento 2.2.6
  2. PHP 7.0
  3. All default options. Manage Stock is ON.

Steps to reproduce (*)

  1. Create a new product (TEST). Give it a price and weight. Create 2 Configurable Options for color (RED and BLUE). Give them both a quantity of 1.
  2. Visit the product page (test.html). Select the RED option and Add to Cart.
  3. Proceed with a successful checkout.
  4. Visit the product page (test.html). Attempt to select the RED option.

Expected result (*)

  1. You should not be able to select RED, because the quantity of "TEST-RED" is 0 and the status is "out-of-stock"

Actual result (*)

  1. You can select RED and click Add to Cart. When you do, you get the "You need to choose options for your item." message.
  2. Manually flushing the cache (or casuing it to be flushed by saving the product) will remove the RED option.
@magento-engcom-team magento-engcom-team added the Issue: Format is valid Gate 1 Passed. Automatic verification of issue format passed label Nov 2, 2018
@magento-engcom-team
Copy link
Contributor

Hi @AndrewPenry. Thank you for your report.
To help us process this issue please make sure that you provided the following information:

  • Summary of the issue
  • Information on your environment
  • Steps to reproduce
  • Expected and actual results

Please make sure that the issue is reproducible on the vanilla Magento instance following Steps to reproduce. To deploy vanilla Magento instance on our environment, please, add a comment to the issue:

@magento-engcom-team give me $VERSION instance

where $VERSION is version tags (starting from 2.2.0+) or develop branches (for example: 2.3-develop).
For more details, please, review the Magento Contributor Assistant documentation.

@AndrewPenry do you confirm that you was able to reproduce the issue on vanilla Magento instance following steps to reproduce?

  • yes
  • no

@AndrewPenry
Copy link
Author

AndrewPenry commented Nov 2, 2018

Hi @AndrewPenry. Thank you for your report.
To help us process this issue please make sure that you provided the following information:

  • Summary of the issue
  • Information on your environment
  • Steps to reproduce
  • Expected and actual results

@AndrewPenry do you confirm that you was able to reproduce the issue on vanilla Magento instance following steps to reproduce?

  • yes

I suspect this is related to #18999

@ghost ghost self-assigned this Nov 6, 2018
@magento-engcom-team
Copy link
Contributor

magento-engcom-team commented Nov 6, 2018

Hi @engcom-backlog-nazar. Thank you for working on this issue.
In order to make sure that issue has enough information and ready for development, please read and check the following instruction: 👇

  • 1. Verify that issue has all the required information. (Preconditions, Steps to reproduce, Expected result, Actual result).

    DetailsIf the issue has a valid description, the label Issue: Format is valid will be added to the issue automatically. Please, edit issue description if needed, until label Issue: Format is valid appears.

  • 2. Verify that issue has a meaningful description and provides enough information to reproduce the issue. If the report is valid, add Issue: Clear Description label to the issue by yourself.

  • 3. Add Component: XXXXX label(s) to the ticket, indicating the components it may be related to.

  • 4. Verify that the issue is reproducible on 2.3-develop branch

    Details- Add the comment @magento-engcom-team give me 2.3-develop instance to deploy test instance on Magento infrastructure.
    - If the issue is reproducible on 2.3-develop branch, please, add the label Reproduced on 2.3.x.
    - If the issue is not reproducible, add your comment that issue is not reproducible and close the issue and stop verification process here!

  • 5. Verify that the issue is reproducible on 2.2-develop branch.

    Details- Add the comment @magento-engcom-team give me 2.2-develop instance to deploy test instance on Magento infrastructure.
    - If the issue is reproducible on 2.2-develop branch, please add the label Reproduced on 2.2.x

  • 6. Add label Issue: Confirmed once verification is complete.

  • 7. Make sure that automatic system confirms that report has been added to the backlog.

@ghost ghost added Issue: Clear Description Gate 2 Passed. Manual verification of the issue description passed Component: ConfigurableProduct Reproduced on 2.2.x The issue has been reproduced on latest 2.2 release Reproduced on 2.3.x The issue has been reproduced on latest 2.3 release Issue: Confirmed Gate 3 Passed. Manual verification of the issue completed. Issue is confirmed labels Nov 6, 2018
@magento-engcom-team magento-engcom-team added the Issue: Ready for Work Gate 4. Acknowledged. Issue is added to backlog and ready for development label Nov 6, 2018
@magento-engcom-team
Copy link
Contributor

@engcom-backlog-nazar Thank you for verifying the issue. Based on the provided information internal tickets MAGETWO-96150, MAGETWO-96151 were created

@ghost ghost removed their assignment Nov 6, 2018
@subbu1993
Copy link

@magento-engcom-team give me 2.2.6 instance

@magento-engcom-team
Copy link
Contributor

Hi @subbu1993. Thank you for your request. I'm working on Magento 2.2.6 instance for you

@magento-engcom-team
Copy link
Contributor

Hi @subbu1993, here is your Magento instance.
Admin access: http://34.228.235.121/i-19043-2-2-6//admin
Login: admin Password: 123123q
Instance will be terminated in up to 3 hours.

@chris-pook
Copy link
Contributor

chris-pook commented Jan 28, 2020

This is still an issue on 2.3.3.

When purchasing the last available stock of a simple product associated to a configurable product, the configurable's cache tag is not cleared. The same is true of updating the stock value via API /rest/V1/products/SKU/stockItems/ITEM_ID.

MAGETWO-96150 and MAGETWO-96151 were created for this in 2018. Please can we have an update of the status there? This is a pretty core mechanism of an eCommerce platform that's making stock control impossible using Magento.

@chris-pook
Copy link
Contributor

The issue looks to be that the stock status of the simples is held in the collections and block_html caches and not re-queried when rendering the configurable's product detail page (despite the fact its FPC cache tag has been cleared). Disabling BOTH of these caches results in the stock updates working as expected.

@chris-pook
Copy link
Contributor

This comes down to the clean_cache_by_tags event dispatched in Magento\CatalogInventory\Model\Indexer\Stock\CacheCleaner::clean() only cleaning the full page cache. There is no event observer for the block_html or collections cache to be cleaned alongside this.

@chris-pook
Copy link
Contributor

Checking if this is fixed in 2.4.x

@magento give me 2.4-develop instance

@magento-engcom-team
Copy link
Contributor

Hi @chris-pook. Thank you for your request. I'm working on Magento 2.4-develop instance for you

@magento-engcom-team
Copy link
Contributor

Hi @chris-pook, here is your Magento instance.
Admin access: https://i-19043-2-4-develop.instances.magento-community.engineering/admin_06a3
Login: 349ae423 Password: fdf1e181feac
Instance will be terminated in up to 3 hours.

@chris-pook
Copy link
Contributor

chris-pook commented Jan 28, 2020

I can't replicate the issue on this 2.4-develop instance, so hopefully this is fixed upstream.

@chris-pook
Copy link
Contributor

chris-pook commented Jan 28, 2020

For anyone else coming across this, there is a fix as of the 2.3.4 release in the following files:

https://github.com/magento/magento2/blob/2.3.4/app/code/Magento/Indexer/etc/di.xml#L70-L72
https://github.com/magento/magento2/blob/2.3.4/app/code/Magento/Indexer/Model/Indexer/CacheCleaner.php

This new plugin causes the required cache flush of the parent configurable product when updating the stock values of the child simples. This fixes the issue of the configurable PDP not reflecting the updated stock status.

https://github.com/magento/magento2/blob/2.3.4/app/code/Magento/ConfigurableProduct/Model/Product/Type/Configurable.php

The changes here fix the issue of all out-of-stock options for a configurable products remaining visible on PDP.

Associated issues: #5948
Related PR: #12936

@ghost ghost removed Issue: Clear Description Gate 2 Passed. Manual verification of the issue description passed Issue: Format is valid Gate 1 Passed. Automatic verification of issue format passed Issue: Ready for Work Gate 4. Acknowledged. Issue is added to backlog and ready for development labels Oct 20, 2020
@magento-engcom-team magento-engcom-team added Priority: P2 A defect with this priority could have functionality issues which are not to expectations. Severity: S2 Major restrictions or short-term circumventions are required until a fix is available. labels Nov 30, 2020
@engcom-Golf engcom-Golf self-assigned this Jan 25, 2021
@m2-assistant
Copy link

m2-assistant bot commented Jan 25, 2021

Hi @engcom-Golf. Thank you for working on this issue.
Looks like this issue is already verified and confirmed. But if you want to validate it one more time, please, go though the following instruction:

    1. Add/Edit Component: XXXXX label(s) to the ticket, indicating the components it may be related to.
    1. Verify that the issue is reproducible on 2.4-develop branch
      Details- Add the comment @magento give me 2.4-develop instance to deploy test instance on Magento infrastructure.
      - If the issue is reproducible on 2.4-develop branch, please, add the label Reproduced on 2.4.x.
      - If the issue is not reproducible, add your comment that issue is not reproducible and close the issue and stop verification process here!
    1. If the issue is not relevant or is not reproducible any more, feel free to close it.

@engcom-Golf
Copy link
Contributor

Hi @AndrewPenry
I was not able to reproduce this issue on 2.4-develop branch. Looks like it was fixed by efb7c61
I will close this issue for now.
Thanks.

@magento-engcom-team
Copy link
Contributor

Hi @AndrewPenry, @engcom-Golf.

Thank you for your report and collaboration!

The related internal Jira ticket MC-24599 was closed as Fixed.

The fix will be available with the upcoming 2.4.3 release.

@magento-engcom-team magento-engcom-team added the Fixed in 2.4.x The issue has been fixed in 2.4-develop branch label Jan 25, 2021
@Tjitse-E
Copy link
Contributor

@magento-engcom-team can you point me to the commit where MC-24599 is fixed? Was this fixed by efb7c61 as @engcom-Golf suggests?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Component: ConfigurableProduct Fixed in 2.4.x The issue has been fixed in 2.4-develop branch Issue: Confirmed Gate 3 Passed. Manual verification of the issue completed. Issue is confirmed Priority: P2 A defect with this priority could have functionality issues which are not to expectations. Progress: done Reproduced on 2.2.x The issue has been reproduced on latest 2.2 release Reproduced on 2.3.x The issue has been reproduced on latest 2.3 release Severity: S2 Major restrictions or short-term circumventions are required until a fix is available.
Projects
Archived in project
Development

No branches or pull requests

7 participants