How to display custom order field in order, invoice and shipment page in Magento2 admin

In this post, we explain how to display order custom field in order, invoice and shipment page. In Magento2, you can figure out lot of frontend customizations examples but only limited examples available in the internet for admin customizations. Subscribe to Bnethos for all the Magento2 problems and customizations

Steps to display custom order field in order, invoice and shipment page in Magento2 admin

You can refer our create a module blog to create a custom module for this issue.

Step 1: Override vendor/magento/module-sales/view/adminhtml/templates/order/view/info.phtml to app/code/Bnethos/AdminOrderCustomField/view/adminhtml/templates/order/view/info.phtml.
Get the custom data from the order and add your custom section to display custom order field. You can find the modified info.phtml, we highlight the custom code in the comments.

Custom code:

Full info.phtml.

Step 2: Override the template in the layout.
For Admin ORDER View Page add the custom below code in the sales_order_view.xml under the path app/code/Bnethos/AdminOrderCustomField/view/adminhtml/layout/sales_order_view.xml

You can see the result of the above layout changes in the below image. The custom order field is displaying in the admin order view page.

For Admin Invoice create and Invoice Page add the custom below code in the sales_order_invoice_new.xml and sales_order_invoice_view.xml under the path app/code/Bnethos/AdminOrderCustomField/view/adminhtml/layout/sales_order_invoice_new.xml and app/code/Bnethos/AdminOrderCustomField/view/adminhtml/layout/sales_order_invoice_view.xml

For Admin Shipment create and Shipment Page add the custom below code in the adminhtml_order_shipment_new.xml and adminhtml_order_shipment_view.xml under the path and app/code/Bnethos/AdminOrderCustomField/view/adminhtml/layout/adminhtml_order_shipment_new.xml and app/code/Bnethos/AdminOrderCustomField/view/adminhtml/layout/adminhtml_order_shipment_view.xml

You can see the result of the above layout changes in the below image. The custom order field is displaying in the admin shipment page.

If you need more help regarding this post, feel free to ask in the Comments section below.

I would be happy to solve your queries.

Related Topic : How to add custom field in admin order create page in Magento2

6 thoughts on “How to display custom order field in order, invoice and shipment page in Magento2 admin”

Leave a Comment