How to create new section in admin order view information tab?

How to create new section in admin order view information tab?

September 13, 2026 · Illustrated author avatarBy Stefan Bogdanescu
How to create new section in admin order view information tab?

Creating a Custom Section in Magento Admin Order View Information Tab

As an experienced Magento developer, I frequently encounter requests from clients who want to add new sections or custom blocks to the admin panel’s Order Information tab. In this post, we’ll guide you through creating and implementing a custom block for the ‘Sales -> Order -> View’ page under the Information tab.

Understanding the Structure

The key components involved in extending an existing Magento layout are:

  1. The Adminhtml block: This is your main extension point where you define the logic for rendering the new section.
  2. The config.xml file: Contains definitions for layout updates, which help load the custom XML layout files.
  3. Layout XML file: Specifies where and how to insert your block into an existing page layout.

Step-by-Step Guide

  1. Create the Adminhtml Block

Open your extension’s Block/Adminhtml folder and create a new PHP class named Company.php:

namespace Namespace\Modulename\Block\Adminhtml;

class Company extends \Magento\Framework\View\Element\Template
{
    // Your block logic here
}

Note: In Magento 2, we use \Magento\Framework\View\Element\Template as the base class for adminhtml blocks.

Add Layout Updates in config.xml

Navigate to your extension’s etc folder and open the config.xml file:

<adminhtml>
    <layout>
        <updates>
            <modulename>
                <file>module.xml</file>
            </modulename>
        </updates>
    </layout>
</adminhtml>

Here, we define a layout update named modulename that points to the custom XML layout file (module.xml).

  1. Create the Custom Layout XML File

In your extension’s etc/adminhtml/layout folder, create a new XML file called module.xml:

<?xml version="1.0"?>
<layout xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:Config/etc:layout_config.xsd">
    <modulename_adminhtml_company_index>
        <reference name="order_info">
            <block type="namespace_modulename_block_adminhtml_company"
                   name="namespace_modulename_company"
                   template="Namespace_Modulename::company.phtml" />
        </reference>
    </modulename_adminhtml_company_index>
</layout>

In this layout file:

  • We define a new update identifier (modulename_adminhtml_company_index).
  • Inside the order_info block, we insert our custom block named namespace_modulename_company.
  • The template attribute points to your custom PHTML file located under the Namespace_Modulename:: path.
  1. Create the Custom Template File

Your extension’s view/adminhtml/templates folder should contain a new file called company.phtml:

<!-- Namespace_Modulename:company.phtml -->
<div class="admin__page-actions">
    <div>
        <h2>My New Custom Section</h2>
        <!-- Add your custom content here -->
    </div>
</div>
  1. Clear Cache and Rebuild

Finally, clear the cache using Magento’s built-in command-line tools:

php bin/magento c:f
php bin/magento c:c

Now, log in to your admin panel and navigate to a specific order under Sales -> Orders. Click on “View” for any order. You should see your new custom section titled “My New Custom Section” appearing under the Information tab.

Remember to replace placeholders like Namespace, Modulename with your actual namespace and module name in all files mentioned above.

Best Practices

  • Keep your block logic minimal and offload complex processing to separate services or models.
  • Ensure your XML layout updates are specific and don’t conflict with core Magento functionality.
  • Test your customizations thoroughly, especially around edge cases and data integrity.

Adding custom sections to the admin Order Information tab allows you to extend the out-of-the-box functionality of Magento while keeping the user experience consistent. If you’re looking for more advanced techniques or need expert assistance with your Magento development, feel free to explore our Magento Development Services at Laravel Company.

Happy coding!

Magento 2 Extensions Themes Admin

Our network