Magento 1.7.0.2: Display default qty in the drop-down bundled product options

Magento 1.7.0.2: Display default qty in the drop-down bundled product options

October 7, 2026 · Illustrated author avatarBy Stefan Bogdanescu
Magento 1.7.0.2: Display default qty in the drop-down bundled product options

Displaying Default Quantity in Magento Bundled Products

Magento’s bundled product options are a powerful feature for creating complex product offerings. However, by default, the quantity of each option isn’t displayed clearly in the dropdown menu. Let’s explore how to modify your Magento theme to show the default quantity next to the product name in the drop-down menu.

Understanding the Current Code Structure

The code you provided is from select.phtml, a file located at app/design/frontend/base/default/template/bundle/catalog/product/view/type/bundle/option/select.phtml. This file renders the dropdown options for each bundled item in your product. The dropdown itself is generated using a select HTML element, and each option within that select menu corresponds to an available selection for the current bundle option.

Modifying the Code to Display Default Quantity

To display the default quantity next to the product name, we need to modify the way each option is rendered in the select.phtml file. Here’s how you can do it:

  1. Locate the line where each option is being created:
<option value="<?php echo $_selection->getSelectionId() ?>" <?php if ($this->_isSelected($_selection)) echo ' selected="selected"' ?><?php if (!$_selection->isSaleable()) echo ' disabled="disabled"' ?>><?php echo $this->getSelectionTitlePrice($_selection, false) ?></option>
  1. Modify the echo statement to include the default quantity:
<option value="<?php echo $_selection->getSelectionId() ?>" <?php if ($this->_isSelected($_selection)) echo ' selected="selected"' ?><?php if (!$_selection->isSaleable()) echo ' disabled="disabled"' ?>><?php echo $this->getSelectionTitlePrice($_selection, false) ?> - Default Quantity: <?php echo $_defaultQty ?></option>

This code grabs the default quantity from the $_defaultQty variable (which is set at the beginning of the script with list($_defaultQty, $_canChangeQty) = $this->_getDefaultValues();) and appends it to the option’s display text.

Retrieving Default Quantity Based on Product ID

If you want to retrieve the default quantity based solely on the product ID without modifying the theme file, you can use Magento’s core functionality. Here’s a simple example using Magento 2:

$objectManager = \Magento\Framework\App\ObjectManager::getInstance();
$optionCollectionFactory = $objectManager->get('\Magento\Bundle\Model\ResourceModel\Option\CollectionFactory');
$collection = $optionCollectionFactory->create()->addFieldToFilter('product_id', $productId);

foreach ($collection as $option) {
    echo 'Product ID: ' . $option->getProductId() . ', Default Quantity: ' . $option->getDefaultSelectionQty();
}

This code retrieves all bundle options for a given product and prints out the product ID and its corresponding default quantity.

Conclusion

Displaying the default quantity in Magento’s bundled product options provides better information to your customers about what they are ordering. By modifying the select.phtml file or using Magento’s core functionality, you can easily achieve this without complex customizations.

Remember to always backup your files before making changes and test thoroughly after implementing these modifications.

For more advanced customization of your Magento store, consider exploring the extensive tutorials on Laravel Company’s Magento blog for tips, tricks, and best practices.

Happy coding!

Magento 1 Catalog Themes Pricing

Our network