Magento 2 troubleshooting › Catalogue
Why are related products not showing on the product page?
Short answer: A related product only shows if it's enabled, visible in the catalog, on the same website, and in stock (unless out-of-stock products are displayed). On Adobe Commerce, the rule-based settings can also hide products you selected by hand.
Related products, up-sells and cross-sells are stored in catalog_product_link with link types 1 (related), 4 (up-sell) and 5 (cross-sell). Cross-sells appear in the cart, not on the product page.
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. The related products and whether each one can show
Magento Open Source
SET @sku = 'ABC-123'; -- your SKU
SELECT c.sku AS related_sku, st.value AS status, vis.value AS visibility,
si.is_in_stock,
(SELECT GROUP_CONCAT(pw.website_id) FROM catalog_product_website pw WHERE pw.product_id = c.entity_id) AS websites
FROM catalog_product_entity p
JOIN catalog_product_link l ON l.product_id = p.entity_id AND l.link_type_id = 1
JOIN catalog_product_entity c ON c.entity_id = l.linked_product_id
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'
LEFT JOIN catalog_product_entity_int st ON st.entity_id = c.entity_id AND st.attribute_id = a_status.attribute_id AND st.store_id = 0
LEFT JOIN catalog_product_entity_int vis ON vis.entity_id = c.entity_id AND vis.attribute_id = a_visibility.attribute_id AND vis.store_id = 0
LEFT JOIN cataloginventory_stock_item si ON si.product_id = c.entity_id
WHERE p.sku = @sku
ORDER BY c.sku;
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 c.sku AS related_sku, st.value AS status, vis.value AS visibility,
si.is_in_stock,
(SELECT GROUP_CONCAT(pw.website_id) FROM catalog_product_website pw WHERE pw.product_id = c.entity_id) AS websites
FROM catalog_product_entity p
JOIN catalog_product_link l ON l.product_id = p.row_id AND l.link_type_id = 1
JOIN catalog_product_entity c ON c.entity_id = l.linked_product_id
AND c.created_in <= UNIX_TIMESTAMP() AND c.updated_in > UNIX_TIMESTAMP()
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'
LEFT JOIN catalog_product_entity_int st ON st.row_id = c.row_id AND st.attribute_id = a_status.attribute_id AND st.store_id = 0
LEFT JOIN catalog_product_entity_int vis ON vis.row_id = c.row_id AND vis.attribute_id = a_visibility.attribute_id AND vis.store_id = 0
LEFT JOIN cataloginventory_stock_item si ON si.product_id = c.entity_id
WHERE p.sku = @sku
AND p.created_in <= UNIX_TIMESTAMP() AND p.updated_in > UNIX_TIMESTAMP()
ORDER BY c.sku;
Status must be 1, visibility 2 or 4 (Catalog or Catalog, Search), and the website must include yours. Change link_type_id = 1 to 4 for up-sells.
2. Does the store hide out-of-stock products?
Works on Magento Open Source and Adobe Commerce:
SELECT scope, scope_id, value
FROM core_config_data
WHERE path = 'cataloginventory/options/show_out_of_stock';
0 or no row: out-of-stock related products are hidden.
How to fix it
- Enable, assign or restock the linked products, or link different ones in the product's Related Products, Up-Sells, and Cross-Sells section.
- On Adobe Commerce, check Stores › Configuration › Catalog › Catalog › Rule-Based Product Relations: if related products are set to Rule-Based Only, products selected by hand don't show.
- If links look right, your theme may not render the block; check the product page layout for the related products block.
Good to know
- On Adobe Commerce,
catalog_product_link.product_idis the parent'srow_id, whilelinked_product_idis the linked product'sentity_id.