Magento: Change order of billing information in checkout

Magento: Change order of billing information in checkout

August 13, 2026 · Illustrated author avatarBy Stefan Bogdanescu
Magento: Change order of billing information in checkout

Customizing Magento Billing Information Layout

As an experienced Magento developer, I often encounter requests from clients seeking to modify the default billing information layout during checkout. By default, Magento arranges the fields in a specific style:

Name Surname

Address

House Number

City, Zip Code

Country

Telephone

However, some clients prefer a different arrangement, such as:

Name Surname

Address House Number

City, Zip Code

Country

Telephone

In this guide, I will walk you through the process of achieving this layout change in your Magento store.

Understanding the Layout Process

Magento uses XML layouts to define the structure and behavior of its blocks. In this case, we need to modify the checkout_onepage_billing layout.

First, let’s locate the relevant file:

app/design/frontend/[Vendor]/[Theme]/layout/checkout.xml

If the file doesn’t exist, you can create it. The [Vendor] and [Theme] placeholders should be replaced with your actual vendor name and theme name.

Modifying the Layout XML

Open the checkout.xml file in a text editor. Add the following code within the <layout> section:

<layout xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:App/etc/layout.xsd">
    <!-- ... other existing layouts ... -->
    <referenceBlock name="checkout.onepage.billing-address-fieldsets" as="billing_address_fieldset" template="Magento_Checkout/billing/address/fieldset.phtml"/>
</layout>

The template attribute specifies the PHTML file that will be used to render the billing address fieldset. We’re overriding it here.

Now, let’s create a new PHTML file:

app/design/frontend/[Vendor]/[Theme]/Magento_Checkout/billing/address/fieldset.phtml

Replace the [Vendor] and [Theme] placeholders with your actual vendor name and theme name.

Customizing the Fieldset Template

Open the newly created fieldset.phtml file. You will find the default structure for rendering the billing address fields.

To achieve the desired layout, you need to rearrange the <div> elements containing each field. Here’s a simplified example:

<?php if ($block->getFormDataObject()->getCountryModel()->isTextRequired()): ?>
    <div class="field country">
        <!-- ... country field HTML goes here ... -->
    </div>
<?php endif; ?>

<div class="field name">
    <?php echo $block->renderField('name'); ?>
</div>

<div class="field surname">
    <?php echo $block->renderField('surname'); ?>
</div>

<div class="field address">
    <?php echo $block->renderField('street'); ?>
</div>

<div class="field house-number city-zip">
    <div class="field house_number">
        <?php echo $block->renderField('house_number'); ?>
    </div>
    <div class="field city">
        <?php echo $block->renderField('city'); ?>
    </div>
    <div class="field zip">
        <?php echo $block->renderField('zip'); ?>
    </div>
</div>

<div class="field country-telephone">
    <div class="field country">
        <?php echo $block->renderField('country_id'); ?>
    </div>
    <div class="field telephone">
        <?php echo $block->renderField('telephone'); ?>
    </div>
</div>

In this example, I’ve moved some of the fields into new div elements to achieve the desired layout. The field names are prefixed with their respective Magento field codes.

Deploying Your Changes

After saving your changes and refreshing the XML file cache, visit your checkout page to verify that the billing information is now displayed in the custom layout you’ve defined.

Remember, this guide provides a general approach. You may need to modify it further depending on your specific theme configuration and any additional modules installed in your Magento store.

For more advanced customizations, I recommend checking out our Magento 2 Customization Guide at LaravelCompany.

Conclusion

In this post, we successfully modified the default billing information layout in the Magento checkout process. By understanding and manipulating the XML layouts and PHTML templates, you can achieve a wide range of customizations to match your brand’s unique style.

Remember, when dealing with Magento, it’s crucial to follow best practices for overriding core files and functionality. Always ensure that you’re using child themes and proper version control practices to protect your modifications from being overwritten during updates.

Happy coding!

Checkout Themes Orders CLI

Our network