Open
Description
Preconditions and environment
- Magento version is the latest 2.4.7-p2
- Varnish is used as FPC
- Indexers are in UPDATE BY SCHEDULE mode
- Cron is running
Steps to reproduce
- Logon into admin panel
- Go to Stores>Configuration>Catalog>Inventory. Open the Stock Options dropdown. Set Yes in the Display Out of Stock Products option
- Create a simple product with a stock quantity (id = 1, SKU = simple1)
- Please note: Varnish cache should be enabled
- Go to System > Extensions > Integrations
- Add new integration.
- Below the General section enter Name, Email (optional), and Password.
- In the left menu, click API.
- From the Resource Access drop-down menu, select All.
- Click Save
- On the Integrations page, next to the newly created integration, click Activate.
- On the Integration page, you can find the list of the resources, click Allow.
- The Integration Token Details are generated.
- Copy and save Access Token to use it further
- Click Done.
- Go to Stores > Configuration > Services > OAuth > Consumer Settings > Allow OAuth Access Tokens to be used as standalone Bearer tokens option to Yes. Save configuration.
- Open the product on the front and see it's in stock
- Use any REST client and run the request
curl -X PUT "https://<magento-host>/rest/V1/products/simple1/stockItems/1" -H "Authorization: Bearer <access-token>" -H "Content-Type:application/json" --globoff -k --data-binary @- << EOF
{
"stock_item": {
"qty": 55.0,
"is_in_stock": false
}
}
EOF
- Refresh the front product page.
Expected result
Product became "Out of Stock" on the front page
Actual result
Product is still "In Stock" on the front page
Additional information
The problem is that Stock indexer does not reset FPC for product (tag: cat_p_) when reindexed
See stock indexer implementation
https://github.com/magento/magento2/blame/2.4-develop/app/code/Magento/CatalogInventory/Model/Indexer/Stock.php#L84
and compare it with the Price indexer
https://github.com/magento/magento2/blob/2.4-develop/app/code/Magento/Catalog/Model/Indexer/Product/Price.php#L96
Release note
No response
Triage and priority
- Severity: S0 - Affects critical data or functionality and leaves users without workaround.
- Severity: S1 - Affects critical data or functionality and forces users to employ a workaround.
- Severity: S2 - Affects non-critical data or functionality and forces users to employ a workaround.
- Severity: S3 - Affects non-critical data or functionality and does not force users to employ a workaround.
- Severity: S4 - Affects aesthetics, professional look and feel, “quality” or “usability”.