How to add extra field "Dropdown List" in Magento One Page Checkout

How to add extra field "Dropdown List" in Magento One Page Checkout

September 20, 2026 · Illustrated author avatarBy Stefan Bogdanescu
How to add extra field "Dropdown List" in Magento One Page Checkout

Extending Magento One Page Checkout with Custom Dropdown Attributes

As an experienced developer and technical blogger, I’ve encountered many scenarios where clients need to extend existing functionalities of e-commerce platforms like Magento. In this post, we’ll explore how to add a custom dropdown attribute to the one-page checkout flow in Magento.

Understanding the Current Setup

The provided code creates a custom module named PS_PB with an attribute called cstpb. This attribute is defined for the customer address entity and uses a custom source model (customeroptions14623605840) to populate the dropdown options. The options are defined as:

  • End Consumer / DIY
  • Service Technician
  • Other Professional

The attribute is configured to be used in various forms, including admin customer edit pages and checkout processes.

Identifying the Issue with Checkout Integration

While the module setup seems correct, there’s a gap in displaying this new attribute on the one-page checkout page. The current configuration only specifies its use in the admin panel and other customer-related pages but fails to integrate it into the checkout flow effectively.

Solving the Problem: Integrating the Attribute into Checkout

To display the cstpb attribute on the one-page checkout page, you’ll need to update a few files:

1. Update the config.xml File

Ensure that your config.xml file is properly structured and contains all necessary elements for your custom module.

<global>
    <models>
        <pb>
            <class>PS_PB_Model</class>
            <resourceModel>pb_mysql4</resourceModel>
        </pb>
    </models>
    <resources>
        <!--... existing setup fields ...-->
    </resources>
</global>

2. Update the customer_attribute.xml File

This file controls which attributes are visible on various pages, including the checkout page.

In your existing code:

<customer_account>
   <primary_business>
       <create>1</create>
       <update>1</update>
   </primary_business>
</customer_account>

Ensure that the create and update fields are set to 1. This enables the attribute to be visible on both the creation and update forms of a customer account.

3. Update the billing.phtml File

The billing.phtml file is responsible for rendering the billing section of the checkout page. To include your custom attribute in this section, you’ll need to add it manually.

Assuming your theme uses the default Magento layout:

  1. Navigate to your active theme directory (e.g., app/design/frontend/base/default/layout/)
  2. Locate and open the checkout.xml file
  3. Find the <billingAddress> block
  4. Add your custom field before or after an existing field

Example:

<block type="core/text_list" name="billing_address_attributes">
    <action method="setUseContainer">
        <argument name="use_container" translate="label" module="pagecache">1</argument>
    </action>
    <block type="customer/form_address_edit" after=" shipping_method_form">
        <!-- Add your custom field here -->
        <reference name="billing_address_fieldset">
            <action method="setTemplate"><template>address/fieldset.phtml</template></action>
        </reference>
    </block>
</block>

4. Update the fieldset.phtml File

This file contains the HTML structure for your custom field.

  1. Navigate to your active theme directory (e.g., app/design/frontend/base/default/template/)
  2. Locate and open the address/fieldset.phtml file
  3. Add a new element for your custom attribute

Example:

<div class="field">
    <label for="cstpb" class="required"><em>*</em><?php echo $this->__('Primary Business') ?></label>
    <?php if ($this->getAttributeCode() == 'cstpb'): ?>
        <?php $_options = $this->getAttributeOptions(); ?>
        <select id="<?php echo $this->getFieldId(); ?>" name="<?php echo $this->getFieldName(); ?>"
                class="validate-select required-entry">
            <option value=""><?php echo $this->__('Please Select') ?></option>
            <?php foreach ($_options as $_option): ?>
                <option value="<?php echo $_option['value']; ?>"
                        <?php if ($this->getValue() == $_option['value']): ?>
                            selected="selected"
                        <?php endif; ?>
                >
                    <?php echo $_option['label']; ?>
                </option>
            <?php endforeach; ?>
        </select>
    <?php else: ?>
        <input type="text" id="<?php echo $this->getFieldId(); ?>" name="<?php echo $this->getFieldName(); ?>"
               value="<?php if ($this->getValue() !== null): echo $this->escapeHtml($this->getValue()); endif; ?>"
               class="input-text <?php if ($this->getRequired()):?> required-entry<?php endif; ?>"
               style="<?php echo $this->getFieldStyle(); ?>"/>
    <?php endif; ?>
</div>

Conclusion

In this post, we’ve explored a common scenario where clients need to extend the one-page checkout process in Magento with custom dropdown attributes. By understanding the current setup and implementing the necessary updates in the config.xml, customer_attribute.xml, billing.phtml, and fieldset.phtml files, you can successfully integrate your custom attribute into the checkout flow.

Remember that proper module configuration and theme integration are key to a successful implementation. Always test your changes thoroughly before deploying them to a production environment.

For more detailed guides on Magento development, be sure to visit Laravel Company. We provide comprehensive resources and tutorials to help you master the intricacies of e-commerce development.

Checkout Extensions Admin Configuration

Our network