Magento 2 troubleshooting › Catalogue
Why doesn't a product show on its category page?
Short answer: The category page reads the category-product index, not the assignment you see in the admin. If the product is assigned but missing from the index for that store view, it won't show. Visibility, status, website and stock decide whether it gets indexed.
Check it step by step
These queries only read data. Run them on a copy of your database if you can, or ask your developer to. If your tables have a prefix (set in app/etc/env.php), add it to each table name.
1. Is it assigned, and is it in the index for the store view?
Works on Magento Open Source and Adobe Commerce:
SET @sku = 'ABC-123'; -- your SKU
SELECT 'assigned' AS source, cp.category_id, NULL AS store_id, cp.position
FROM catalog_category_product cp
JOIN catalog_product_entity e ON e.entity_id = cp.product_id
WHERE e.sku = @sku
UNION ALL
SELECT 'indexed (store 1)', ix.category_id, ix.store_id, ix.position
FROM catalog_category_product_index_store1 ix
JOIN catalog_product_entity e ON e.entity_id = ix.product_id
WHERE e.sku = @sku;
Change _store1 to your store view's ID. Assigned but not indexed means one of the checks below fails, or the index is out of date.
2. Visibility and status in that store view
Visibility 1 (Not Visible Individually) and 3 (Search only) keep a product off category pages. A store-view value overrides the default.
Magento Open Source
SET @sku = 'ABC-123'; -- your SKU
SELECT a.attribute_code, v.store_id, v.value
FROM catalog_product_entity e
JOIN eav_entity_type t ON t.entity_type_code = 'catalog_product'
JOIN eav_attribute a_status ON a_status.entity_type_id = t.entity_type_id AND a_status.attribute_code = 'status'
JOIN eav_attribute a_visibility ON a_visibility.entity_type_id = t.entity_type_id AND a_visibility.attribute_code = 'visibility'
JOIN catalog_product_entity_int v ON v.entity_id = e.entity_id AND v.attribute_id IN (a_status.attribute_id, a_visibility.attribute_id)
JOIN eav_attribute a ON a.attribute_id = v.attribute_id
WHERE e.sku = @sku
ORDER BY a.attribute_code, v.store_id;
Adobe Commerce
Product, category, rule and CMS values are stored per version and joined on row_id (why):
SET @sku = 'ABC-123'; -- your SKU
SELECT a.attribute_code, v.store_id, v.value
FROM catalog_product_entity e
JOIN eav_entity_type t ON t.entity_type_code = 'catalog_product'
JOIN eav_attribute a_status ON a_status.entity_type_id = t.entity_type_id AND a_status.attribute_code = 'status'
JOIN eav_attribute a_visibility ON a_visibility.entity_type_id = t.entity_type_id AND a_visibility.attribute_code = 'visibility'
JOIN catalog_product_entity_int v ON v.row_id = e.row_id AND v.attribute_id IN (a_status.attribute_id, a_visibility.attribute_id)
JOIN eav_attribute a ON a.attribute_id = v.attribute_id
WHERE e.sku = @sku
AND e.created_in <= UNIX_TIMESTAMP() AND e.updated_in > UNIX_TIMESTAMP()
ORDER BY a.attribute_code, v.store_id;
3. Website assignment
Works on Magento Open Source and Adobe Commerce:
SET @sku = 'ABC-123'; -- your SKU
SELECT w.code AS website
FROM catalog_product_entity e
JOIN catalog_product_website pw ON pw.product_id = e.entity_id
JOIN store_website w ON w.website_id = pw.website_id
WHERE e.sku = @sku;
How to fix it
- Fix the cause (visibility, status, website or stock), then reindex:
bin/magento indexer:reindex catalog_category_product catalog_product_category. - If the product is out of stock, it's hidden unless Stores › Configuration › Catalog › Inventory › Display Out of Stock Products is Yes.
- Anchor categories also show products from their subcategories; non-anchor categories only show products assigned directly.