How to Add Custom Block in Admin Sales Order View in Magento 2

How to Add Custom Block in Admin Sales Order View in Magento 2

The default Magento 2 displays the address information, payment, and shipping information, etc. on the admin sales order view.

However, sometimes it may not be enough based on the business requirements.

Therefore, one needs to add custom block in admin sales order view in Magento 2.

For example, you are offering customized products and the customers add instructions for their personalization. To display those instruction texts in the admin sales order view, you can use the below solution.

Or, if you are an Indian store, you may display GST information in the sales order view.

Display any custom block based on your business requirements as shown in the below figure:

Add Custom Block in Admin Sales Order View in Magento 2

Steps to add custom block to admin sales order view in Magento 2:

  1. Create registration.php file at app\code\Vendor\Module directory
  2. Create module.xml file at app\code\Vendor\Module\etc directory
  3. Create sales_order_view.xml file at app\code\Vendor\Module\view\adminhtml\layout
  4. Create block file View.php in Vendor\Module\Block\Adminhtml\Order\View

  5. Create view.phtml in Vendor\Module\view\adminhtml\templates\order\view

That’s it.

Any doubts about the solution can be mentioned in the Comments section below.

I’d be happy to help.

Also, do share the solution with the Magento Community via social media.

Thank you.


Get Weekly Updates

Never miss Magento tips, tricks, tutorials, and news.

Thank you for subscribing.

Something went wrong.

(based on 13 Reviews)

Kanchi is a Magento Developer at Meetanshi. Apart from that, she is into dancing. In her free time, she likes to make handmade art and craft.

Leave a reply:

Your email address will not be published.