Add custom header for Checkout pages in Magento (1.8.x)

Add custom header for Checkout pages in Magento (1.8.x)

August 12, 2026 · Illustrated author avatarBy Stefan Bogdanescu
Add custom header for Checkout pages in Magento (1.8.x)

Customizing Checkout Headers in Magento (1.8.x): A Step-by-Step Guide

As a senior developer working with Magento platforms, I often receive queries about customizing checkout pages to meet specific business requirements. One common question is how to replace or alter the default header on all checkout pages within your store. In this post, we’ll walk through the process of creating a new custom header and applying it exclusively to your checkout pages in Magento 1.8.x.

Understanding the Default Checkout Layout

Magento’s default layout for checkout pages can be found at app/design/frontend/base/default/layout/checkout.xml. The file contains XML definitions that control the structure and appearance of the checkout process. To modify or remove elements, you need to understand how these layouts are structured and inherited through themes.

The Goal: An Altered Header Only on Checkout Pages

Your aim is to create a new header design that applies only to all the pages in your store’s checkout flow—from the cart to the order confirmation page. This header should be distinct from the standard header used on other parts of your website. To achieve this, we’ll create a new layout XML file within our theme directory.

Step 1: Create Your Custom Header

Design or modify your new header template in the app/design/frontend/your_package/your_theme/template/page/html folder. Name it something like custom_header.phtml. This is where you can add any custom HTML, CSS, or JavaScript required for your checkout-specific header.

Step 2: Configure Your New Layout

Create a new XML file in the same theme directory but under the layout folder. Name this file checkout.xml.

Open the checkout.xml file and paste the following code:

<default>
    <reference name="header">
        <action method="setTemplate">
            <template>page/html/custom_header.phtml</template>
        </action>
    </reference>
</default>

This XML snippet tells Magento to replace the default header with your new custom_header.phtml file for all pages in the default layout. This means it will apply to every page in your store, which isn’t what we want.

Step 3: Apply Your Custom Header Only to Checkout Pages

To restrict this customization to only checkout pages, we need to use Magento’s layout handle system. Each checkout stage (like cart, login, shipping address, etc.) has a unique handle that we can target.

Open the checkout.xml file again and modify it as follows:

<default>
    <reference name="header">
        <action method="setTemplate">
            <template>page/html/custom_header.phtml</template>
            <handle>checkout_cart_index</handle>
        </action>
    </reference>
</default>

<!-- Add this block for other checkout handles -->
<onepagecheckout_checkout_index_index>
    <remove name="header" />
    <block type="core/text_list" name="header" as="header">
        <block type="page/html" />
    </block>
    <block type="core/text_list" name="custom_header" as="custom_header">
        <action method="setTemplate">
            <template>page/html/custom_header.phtml</template>
        </action>
    </block>
    <move element="custom_header" destination="header" after="-"/>
</onepagecheckout_checkout_index_index>

<!-- Add similar blocks for other checkout handles like checkout_onepage_index_save -->

This updated code targets the checkout_cart_index handle (which represents the shopping cart page) and sets your new header template. We also include a block for the main one-page checkout process (onepagecheckout_checkout_index_index) to ensure our custom header appears on all subsequent checkout stages.

Conclusion

By following these steps, you can successfully create and apply a custom header that only appears on the checkout pages of your Magento 1.8.x store. This provides a consistent user experience across the entire purchase flow while maintaining the standard header on other parts of your website.

Remember to always test your changes thoroughly in a staging environment before deploying them to your live site, especially when dealing with critical templates like headers and footers.

For more detailed guides on Magento customization, don’t forget to check out our blog at https://laravelcompany.com. We regularly publish articles on advanced Magento development techniques and best practices.

Magento 1 Checkout Themes Orders

Our network