Preconditions
- Install Magento Open Source 2.2.4 with sample data
- Setup CRON
- Change all indexes to “UPDATE BY SCHEDULE”
Steps to reproduce
- Locate a simple product in the backend
- Click “Save & Duplicate”
- Set the following attribute values on the newly created product and then click “Save”:
- Enabled: True
- Quantity: 1
- Stock Status: In Stock
- Load the product on the frontend (either by loading the url key or by accessing the product directly via /catalog/product/view/<ID>)
Expected result
- The product should show with an “Add to Cart” button:

Actual result
- The product shows as “Out of Stock”:

- If I run these commands, then the product shows as in stock:
bin/magento indexer:reindex cataloginventory_stock
bin/magento cache:flush
Still facing this issue on latest 2.4-develop
Preconditions
Steps to Rerpoduce:
Actual Result: The product shows as “Out of Stock”:
@engcom-backlog-nazar yep, looks like #12205 does not actually fix this particular issue… apologies.
Upon investigating this one further - this looks to be due to an omission in the way the stock indexer changelog is triggered on INSERT / UPDATES / DELETES…
For example…
Updating a product’s details relating to inventory (ie: qty or stock status), will result in the item being scheduled for update in the stock index - as such, the product becomes available for sale after the schedule update is completed.
Updating a product’s attribute details (ie: enabling / disabling a product’s status), will NOT result in the item being scheduled for an update in the stock index — this can result in the item becoming available in Magento’s frontend, but in a state where it will appear as “Out Of Stock”
The problem would also appear to be related to “disabled” products not containing an entry in the
cataloginventory_stock_statustable. As such, once it’s enabled, it never gets this entry.For example — updates to the
catalog_product_entityandcatalog_product_entity_inttables does not trigger updates to the stock indexer changelog.catalog_product_entity triggers
catalog_product_entity_int triggers