How to find if a bundle product is out of stock?

How to find if a bundle product is out of stock?

September 9, 2026 · Illustrated author avatarBy Stefan Bogdanescu
How to find if a bundle product is out of stock?

Understanding Magento Bundle Product Stock Management

In Magento, managing stock for bundle products can sometimes be confusing due to how Magento calculates product availability. This confusion often arises when you set the main bundle product as out of stock in the admin, yet it still appears as “In stock” on the frontend.

The issue lies in the way Magento determines if a bundle product is out of stock or not. It doesn’t simply rely on the stock status of the primary bundle product itself; instead, it checks the stock availability of all the items included within that bundle.

Why the Bundle Product Appears “In Stock”

Let’s take a closer look at the code you provided from app/design/frontend/default/rfg/template/bundle/catalog/product/view/type/bundle.phtml. This snippet is checking if the product is available using the $_product->isAvailable() method. In most cases, this should work as expected.

However, for bundle products, Magento’s isAvailable method behaves a bit differently. It doesn’t just check the primary product; it also checks the availability of all the items associated with that bundle. If even one item in the bundle is available, the main bundle product will be marked as “In stock”.

Why the Current Setup Doesn’t Work

When you set your bundle product to out of stock in the Magento admin, you’re essentially setting the main product’s stock status to 0 (or 2 for not available). However, this doesn’t automatically update the isAvailable status of all the items within the bundle.

The current setup in your code only checks if the primary product is available. It ignores the availability status of the bundled items entirely. This is why you’re seeing “In stock” even though you’ve manually set the main product as out of stock.

Solving the Out-of-Stock Issue for Bundle Products

To resolve this issue, we need to modify our approach slightly. Instead of relying on the isAvailable method, which checks both the primary product and its items, we should directly check the stock status of the primary bundle product.

Here’s how you can update your code:

<?php if ($_product->getStockItem()->getIsInStock()): ?>
    <p class="availability in-stock"><span><?php echo $this->__('In stock') ?></span></p>
<?php else: ?>
    <p class="availability out-of-stock"><span><?php echo $this->__('Out of Stock') ?></span></p>
<?php endif; ?>

With this change, the code now directly checks if the primary bundle product is in stock or not using getStockItem()->getIsInStock(). This method only looks at the stock status of the main product and ignores the items within the bundle.

Conclusion

Magento’s handling of bundle product stock can be complex, especially when dealing with multiple associated items. By understanding how the isAvailable method works and directly checking the primary product’s stock status instead, we can successfully display “Out of Stock” for a bundle product even if some of its items are available.

Remember that this change only affects the main bundle product’s availability message on the frontend and doesn’t impact the actual inventory management or availability of the associated items within the bundle.

Catalog Themes Admin Configuration

Our network