I'm trying to display the bundled product in the category product list on the frontend even when the simple product it concists of is out of stock. I only want to hide the add to cart button.

I've looked into changing the Mage_Bundle_Model_Product_Type class to return true on the stock check but that is not really a solution.

Is there a way to do this in a clean way either trough settings or by extending as little core code as possible?


You could create some method in one of the helpers

public function isBundleAvailable($_product) {
    $bundle = Mage::getModel('catalog/product')->load($_product->getId());
    $selectionCollection = $bundle->getTypeInstance(true)->getSelectionsCollection(
        $bundle->getTypeInstance(true)->getOptionsIds($bundle), $bundle
    $items = array();

    foreach($selectionCollection as $option) {        
        $isAvailable = $option->getStockItem()->getIsInStock();
        if (!$isAvailable) {
            return false;
     return true;

Then in template you could use something like that:

<?php if (Mage::helper('my_module')->isBundleAvailable($_product)): ?>
    <?php //display add to cart button
<?php endif ?>
| improve this answer | |

The bundled product should be visible when you have the option: System > Configuration > Inventory > Stock Options > Display Out of Stock Products set to Yes. All out of stock products are listed but you have no Add to Cart button.

| improve this answer | |
  • already tried that and it doesn't work for bundle products – adrian.robert.onac Feb 7 '13 at 12:35
  • It's working for me on a plain 1.7 install with the test data. – Vladimir Kerkhoff Feb 12 '13 at 20:42

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.