{"id":1792,"date":"2021-05-24T05:14:11","date_gmt":"2021-05-24T05:14:11","guid":{"rendered":"https:\/\/meetanshi.com\/blog\/override-name-phtml-file-for-order-invoice-and-shipment-in-magento-2\/"},"modified":"2025-07-16T17:45:59","modified_gmt":"2025-07-16T12:15:59","slug":"override-name-phtml-file-for-order-invoice-and-shipment-in-magento-2","status":"publish","type":"post","link":"https:\/\/meetanshi.com\/blog\/override-name-phtml-file-for-order-invoice-and-shipment-in-magento-2\/","title":{"rendered":"How to Override name.phtml File for Order, Invoice and Shipment in Magento 2"},"content":{"rendered":"\n<p class=\"wp-block-paragraph\">Overriding name.phtml file can be considered as a frequently required task for a developer who wants customization in the order, invoice, and shipment in Magento 2.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">It is widely accepted that modifying the core functionality of default\u00a0Magento 2\u00a0is inappropriate. Thus, it is highly recommended to override the file instead of modifying any core file.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">For instance, if a store owner requires to get the value or file in the invoice, shipment, or order view page of the admin panel that the customer added through a custom field or file uploader from an order page.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">In such a case, you first have to follow the method to&nbsp;<em><strong>override name.phtml file for order, invoice and shipment in Magento 2&nbsp;<\/strong><\/em>and then you can get values using further code as per your business requirement.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">You can override the name.phtml file for the below files:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li><strong>For Creditmemo<\/strong>\n<ul class=\"wp-block-list\">\n<li>&nbsp;sales_order_creditmemo_new.xml<\/li>\n\n\n\n<li>&nbsp;sales_order_creditmemo_updateqty.xml<\/li>\n\n\n\n<li>&nbsp;sales_order_creditmemo_view.xml<\/li>\n<\/ul>\n<\/li>\n\n\n\n<li><strong>For Orders<\/strong>\n<ul class=\"wp-block-list\">\n<li>sales_order_view.xml<\/li>\n<\/ul>\n<\/li>\n\n\n\n<li><strong>For Invoice<\/strong>\n<ul class=\"wp-block-list\">\n<li>&nbsp;sales_order_invoice_new.xml<\/li>\n\n\n\n<li>&nbsp;sales_order_invoice_updateqty.xml<\/li>\n\n\n\n<li>&nbsp;sales_order_invoice_view.xml<\/li>\n<\/ul>\n<\/li>\n\n\n\n<li><strong>For Shipment<\/strong>\n<ul class=\"wp-block-list\">\n<li>&nbsp;adminhtml_order_shipment_new.xml<\/li>\n\n\n\n<li>&nbsp;adminhtml_order_shipment_view.xml<\/li>\n<\/ul>\n<\/li>\n<\/ul>\n\n\n\n<p class=\"wp-block-paragraph\">Use the below code to override name.phtml file.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Method to Override name.phtml File for Order, Invoice and Shipment in Magento 2<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">Use the below code in your&nbsp;<strong>.xml<\/strong>&nbsp;file located at&nbsp;<strong>Vendor\/Module\/view\/adminhtml\/layout<\/strong><\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">&lt;?xml version=\"1.0\"?>\n&lt;page xmlns:xsi=\"http:\/\/www.w3.org\/2001\/XMLSchema-instance\"\n      xsi:noNamespaceSchemaLocation=\"urn:magento:framework:View\/Layout\/etc\/page_configuration.xsd\">\n    &lt;body>\n        &lt;referenceBlock name=\"order_items\">\n            &lt;block class=\"Magento\\Sales\\Block\\Adminhtml\\Items\\Column\\Name\" name=\"column_name\"\n                   template=\"Vendor_Module::items\/column\/name.phtml\" group=\"column\"\/>\n        &lt;\/referenceBlock>\n    &lt;\/body>\n&lt;\/page><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">You can override for any of the files mentioned above.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">For example, I\u2019ve override&nbsp;<strong>name.phtml<\/strong>&nbsp;file&nbsp;<strong>for sales_order_view.xml<\/strong>&nbsp;as shown below:<\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">&lt;?xml version=\"1.0\"?>\n&lt;page xmlns:xsi=\"http:\/\/www.w3.org\/2001\/XMLSchema-instance\"\n      xsi:noNamespaceSchemaLocation=\"urn:magento:framework:View\/Layout\/etc\/page_configuration.xsd\">\n    &lt;update handle=\"sales_order_transactions_grid_block\"\/>\n    &lt;update handle=\"sales_order_item_price\"\/>\n    &lt;body>\n        &lt;referenceBlock name=\"order_items\">\n            &lt;block class=\"Magento\\Sales\\Block\\Adminhtml\\Items\\Column\\Name\" name=\"column_name\"\n                   template=\"Vendor_Module::items\/column\/name.phtml\" group=\"column\"\/>\n        &lt;\/referenceBlock>\n    &lt;\/body>\n&lt;\/page><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">Now you need to create&nbsp;<strong>name.phtml<\/strong>&nbsp;at&nbsp;<strong>Vendor\/Module\/view\/adminhtml\/templates\/items\/column<\/strong><\/p>\n\n\n\n<p class=\"wp-block-paragraph\">That\u2019s all!<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Feel free to share the post with fellow developers via social media.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">You can also refer to the relevant solution to&nbsp;<a href=\"https:\/\/meetanshi.com\/blog\/override-block-model-controller-magento-2\/\" target=\"_blank\" rel=\"noreferrer noopener\">override block, model, and controller in Magento 2<\/a>&nbsp;and&nbsp;<a href=\"https:\/\/meetanshi.com\/blog\/override-phtml-file-using-custom-module-in-magento-2\/\" target=\"_blank\" rel=\"noreferrer noopener\">override a phtml file using a custom module in Magento 2<\/a>&nbsp;that I posted earlier.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Thank You.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Overriding name.phtml file can be considered as a frequently required task for a developer who wants customization in the order, invoice, and shipment in Magento&#8230;<\/p>\n","protected":false},"author":5,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"footnotes":""},"categories":[34],"tags":[],"class_list":["post-1792","post","type-post","status-publish","format-standard","hentry","category-magento"],"acf":[],"_links":{"self":[{"href":"https:\/\/meetanshi.com\/blog\/wp-json\/wp\/v2\/posts\/1792","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/meetanshi.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/meetanshi.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/meetanshi.com\/blog\/wp-json\/wp\/v2\/users\/5"}],"replies":[{"embeddable":true,"href":"https:\/\/meetanshi.com\/blog\/wp-json\/wp\/v2\/comments?post=1792"}],"version-history":[{"count":4,"href":"https:\/\/meetanshi.com\/blog\/wp-json\/wp\/v2\/posts\/1792\/revisions"}],"predecessor-version":[{"id":18064,"href":"https:\/\/meetanshi.com\/blog\/wp-json\/wp\/v2\/posts\/1792\/revisions\/18064"}],"wp:attachment":[{"href":"https:\/\/meetanshi.com\/blog\/wp-json\/wp\/v2\/media?parent=1792"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/meetanshi.com\/blog\/wp-json\/wp\/v2\/categories?post=1792"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/meetanshi.com\/blog\/wp-json\/wp\/v2\/tags?post=1792"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}