Magento 2 troubleshooting › Stock and inventory
Why does a bundle product show out of stock?
Short answer: A bundle is salable only if every required option has at least one selection that's enabled, in stock, and has at least the selection's default quantity. One empty required option makes the whole bundle out of stock.
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. Required options with no selection in stock
Magento Open Source
SET @sku = 'ABC-123'; -- your SKU
SELECT o.option_id, ov.title AS option_title
FROM catalog_product_entity p
JOIN catalog_product_bundle_option o ON o.parent_id = p.entity_id AND o.required = 1
LEFT JOIN catalog_product_bundle_option_value ov ON ov.option_id = o.option_id AND ov.store_id = 0
WHERE p.sku = @sku
AND NOT EXISTS (
SELECT 1 FROM catalog_product_bundle_selection s
JOIN cataloginventory_stock_item si ON si.product_id = s.product_id
WHERE s.option_id = o.option_id AND si.is_in_stock = 1 AND si.qty >= s.selection_qty
);
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 o.option_id, ov.title AS option_title
FROM catalog_product_entity p
JOIN catalog_product_bundle_option o ON o.parent_id = p.row_id AND o.required = 1
LEFT JOIN catalog_product_bundle_option_value ov ON ov.option_id = o.option_id AND ov.store_id = 0
WHERE p.sku = @sku
AND p.created_in <= UNIX_TIMESTAMP() AND p.updated_in > UNIX_TIMESTAMP()
AND NOT EXISTS (
SELECT 1 FROM catalog_product_bundle_selection s
JOIN cataloginventory_stock_item si ON si.product_id = s.product_id
WHERE s.option_id = o.option_id AND si.is_in_stock = 1 AND si.qty >= s.selection_qty
);
Any row here is the reason. A selection with default quantity 2 needs at least 2 in stock.
2. Every option and selection, with status and stock
Magento Open Source
SET @sku = 'ABC-123'; -- your SKU
SELECT o.option_id, ov.title AS option_title, o.required,
c.sku AS selection_sku, s.selection_qty, st.value AS status, si.qty, si.is_in_stock
FROM catalog_product_entity p
JOIN catalog_product_bundle_option o ON o.parent_id = p.entity_id
LEFT JOIN catalog_product_bundle_option_value ov ON ov.option_id = o.option_id AND ov.store_id = 0
JOIN catalog_product_bundle_selection s ON s.option_id = o.option_id
JOIN catalog_product_entity c ON c.entity_id = s.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'
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 cataloginventory_stock_item si ON si.product_id = c.entity_id
WHERE p.sku = @sku
ORDER BY o.position, o.option_id, s.position;
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 o.option_id, ov.title AS option_title, o.required,
c.sku AS selection_sku, s.selection_qty, st.value AS status, si.qty, si.is_in_stock
FROM catalog_product_entity p
JOIN catalog_product_bundle_option o ON o.parent_id = p.row_id
LEFT JOIN catalog_product_bundle_option_value ov ON ov.option_id = o.option_id AND ov.store_id = 0
JOIN catalog_product_bundle_selection s ON s.option_id = o.option_id
JOIN catalog_product_entity c ON c.entity_id = s.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'
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 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 o.position, o.option_id, s.position;
3. The bundle's own stock flag
Works on Magento Open Source and Adobe Commerce:
SET @sku = 'ABC-123'; -- your SKU
SELECT e.sku, si.is_in_stock
FROM catalog_product_entity e
JOIN cataloginventory_stock_item si ON si.product_id = e.entity_id
WHERE e.sku = @sku;
If the bundle itself is set to Out of Stock, it stays out of stock whatever its options have.
How to fix it
- Restock or enable a selection in each required option, make the option not required, or remove dead selections from the bundle.
- Reindex stock after fixing:
bin/magento indexer:reindex cataloginventory_stock inventory. - Disabled selections count as unavailable even when they have stock.
Good to know
- On Adobe Commerce,
catalog_product_bundle_option.parent_idandcatalog_product_bundle_selection.parent_product_idhold the bundle'srow_id;selection.product_idis the child'sentity_id.