How do I add a tab to the Sale Order Admin Page?

How do I add a tab to the Sale Order Admin Page?

September 1, 2026 · Illustrated author avatarBy Stefan Bogdanescu
How do I add a tab to the Sale Order Admin Page?

Adding a Custom Tab to Magento Order Admin Page

Are you looking to enhance your Magento admin interface by adding a custom tab to the order page? You’re not alone. Many Magento developers need to introduce additional functionality directly within the admin dashboard.

Understanding the Magento Admin XML Layout System

Before diving into the code, let’s briefly understand how Magento uses XML layout files to manage the admin interface. These XML files define the structure and behavior of blocks on each admin page.

The order admin page is defined in app/code/core/Mage/Adminhtml/blocks/Sales/Order/Edit/Tabs.php. This file loads a series of tabs using the <block> tag, each with its own type (type="edit_form" for basic information).

Overriding the Order Admin XML Layout

The key to adding a custom tab is overriding this layout file. Magento 2 supports layout override via your theme or module.

Here’s how you can achieve this in a simple way:

  1. Navigate to app/code/your-module/view/adminhtml/layout/sales_order_view.xml (create the folder structure if it doesn’t exist).

  2. Open this XML file and paste the following code, replacing your-tab-title with your desired tab name:

<layout xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/layout.xsd">
    <update handle="sales_order_view"/>
    <referenceBlock name="page.main.title">
        <action method="setText"><argument name="text" xsi:type="string">Your Order</argument></action>
    </referenceBlock>
    <block type="core/text_list" name="sales.order.tabs" as="tabs" translate="label">
        <action method="addTab", name="your-tab-title">
            <argument name="label" xsi:type="string">Your Tab Title</argument>
            <argument name="content" xsi:type="block">your-module/adminhtml_sales_order_your-tab-block</argument>
        </action>
    </block>
</layout>

Note: Replace your-module with the actual module code that contains your custom tab.

  1. Create a new file at app/code/your-module/view/adminhtml/templates/sales/order/your-tab-block.phtml and add your custom HTML content inside this block.

  2. Compile Magento to apply the layout changes:

php bin/magento setup:di:compile

The Benefits of Using a Module for Layout Overrides

While it’s possible to override layouts through your theme, using a module provides several benefits:

  • Cleaner Theme: Your theme remains clean and focused on CSS.
  • Easy Deployment: You can deploy the custom tab as part of a separate module.
  • Reusability: The layout modifications are reusable across projects.

For more advanced scenarios or to understand how Laravel Company can help you with complex Magento development, feel free to reach out to us here.

Conclusion

Adding a custom tab to the order admin page in Magento isn’t as daunting as it seems. By understanding and leveraging the XML layout system, you can easily extend the admin interface.

Remember, keeping your overrides in a module instead of a theme is a best practice for maintaining a clean codebase. If you need professional assistance with Magento customizations or any other Laravel development services, don’t hesitate to contact our expert team at Laravel Company.

Magento 2 Extensions Themes Admin

Our network