Skip to content

Product showing out of stock but In stock in backend #39889

Open
@januszd17

Description

@januszd17

Preconditions and environment

2.4.7-p3
Stock status mismatch: product shows as in-stock in backend, out-of-stock in frontend (cataloginventory_stock_status vs. cataloginventory_stock_item)

We are encountering a recurring issue where Magento products display as out of stock on the frontend even though they are marked in stock in the admin backend.
This mismatch appears to be caused by desynchronization between the cataloginventory_stock_item and cataloginventory_stock_status tables.

Steps to reproduce

Import or update products (via integration, API, or backend)
Check Magento admin → product shows is_in_stock = 1
Check Magento frontend → product displays as out of stock

Expected result

Frontend and backend stock statuses should match.
If cataloginventory_stock_item.is_in_stock = 1, the product should display as in stock on the frontend.

Actual result

cataloginventory_stock_item.is_in_stock = 1 (correct)
cataloginventory_stock_status.stock_status = 0 (incorrect)
Frontend shows product as out of stock.

Additional information

Example SQL to identify issue:
SELECT cpe.entity_id,
cpe.sku,
csi.is_in_stock AS stock_item_status,
css.stock_status AS stock_status_valueFROM catalog_product_entity cpeJOIN cataloginventory_stock_item csi ON cpe.entity_id = csi.product_idJOIN cataloginventory_stock_status css ON cpe.entity_id = css.product_idWHERE csi.is_in_stock != css.stock_status;
Temporary workaround:
UPDATE cataloginventory_stock_status cssJOIN cataloginventory_stock_item csi ON css.product_id = csi.product_idSET css.stock_status = csi.is_in_stockWHERE css.stock_status != csi.is_in_stock;
Followed by:
php bin/magento indexer:reindex
php bin/magento cache:flush

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”.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Area: APIsComponent: StockIssue: ConfirmedGate 3 Passed. Manual verification of the issue completed. Issue is confirmedPriority: P2A defect with this priority could have functionality issues which are not to expectations.Reported on 2.4.7-p3Indicates original Magento version for the Issue report.Reproduced on 2.4.xThe issue has been reproduced on latest 2.4-develop branch

    Type

    No type

    Projects

    Status

    Ready for Development

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions