add custom field in billing & shipping magento

add custom field in billing & shipping magento

August 22, 2026 · Illustrated author avatarBy Stefan Bogdanescu
add custom field in billing & shipping magento

Adding Custom Fields to Billing & Shipping in Magento

Hello! In this tutorial, we’ll guide you through adding custom radio button fields for ‘Residential’ and ‘Commercial’ options to both the Billing and Shipping checkout pages in your Magento store.

Step 1: Create a New Attribute Set

First, let’s create a new attribute set that will hold our custom field. In your Magento admin panel:

  1. Navigate to Catalog > Attributes.
  2. Click on “Add New Attribute.”
  3. Fill in the following details:
    • Attribute Code: checkout_type
    • Scope: Global
    • Input Type for Store Owner: Dropdown
  4. Click “Save Attribute.”

Step 2: Add the Attribute to Customer Address Entity

Now, we need to associate this attribute with the customer address entity:

  1. In your database, locate the eav_attribute table.
  2. Insert a new row with the following values:
    • attributes_id (auto-increment)
    • entity_type_id: 2 (for customer_address_entity)
    • attribute_code: checkout_type
    • backend_model: eav/entity_int
    • frontend_input: select
    • frontend_label: Checkout Type
    • is_required: 0
    • is_user_defined: 1
    • default_value: NULL

Step 3: Create Option Values for the Attribute

Let’s define the ‘Residential’ and ‘Commercial’ options:

  1. In your Magento admin panel, go to System > Manage Attributes.
  2. Search for the checkout_type attribute we created earlier.
  3. Click on “Manage Label/Options.”
  4. Add two new options:
    • Option Value: 0 Value to Store in Database: Residential
    • Option Value: 1 Value to Store in Database: Commercial

Step 4: Update the Checkout Template Files

We need to modify the checkout template files to display our custom radio buttons:

  1. Open the file app/design/frontend/base/default/template/checkout/onepage/billing.phtml.
  2. Add the following lines just above the closing </form> tag:
<div class="field">
    <label for="checkout_type">Checkout Type:</label>
    <input type="radio" name="checkout_type" id="residential" value="0" />
    <label for="residential">Residential</label>
    <input type="radio" name="checkout_type" id="commercial" value="1" />
    <label for="commercial">Commercial</label>
</div>
  1. Make the same changes to app/design/frontend/base/default/template/checkout/onepage/shipping.phtml.

Step 5: Update the Checkout Controller

Finally, we need to update the checkout controller to save and process our new field:

  1. Open app/code/core/Mage/Checkout/controllers/OnepageController.php.
  2. In the saveShippingInformation action, add the following line within the if ($this->getRequest()->isPost()) condition:
$checkoutType = $this->getRequest()->getParam('checkout_type');
  1. Then, update the $data array with the new field:
$data['customer_address_id'] = $addressId;
$data['checkout_type']      = $checkoutType;
  1. Repeat this process in the saveBillingInformation action.

Conclusion

That’s it! You’ve successfully added a custom ‘Checkout Type’ radio button to both your Billing and Shipping checkout pages in Magento 1.4.2.0. This field will now be saved along with the customer’s address information.

Remember, while this tutorial provides a solution for an older version of Magento, many of these concepts still apply to later versions like Magento 2. For more advanced customizations and extensions, I recommend checking out Laravel Company’s Magento development services, where our team of expert developers can help you build powerful solutions tailored to your business needs.

Happy coding!

Checkout Catalog Database Admin

Our network