{"id":1136,"date":"2020-07-23T09:43:01","date_gmt":"2020-07-23T09:43:01","guid":{"rendered":"https:\/\/meetanshi.com\/blog\/2020\/07\/23\/add-column-to-sales-order-history-page-magento-2\/"},"modified":"2025-05-22T12:08:21","modified_gmt":"2025-05-22T06:38:21","slug":"add-column-to-sales-order-history-page-magento-2","status":"publish","type":"post","link":"https:\/\/meetanshi.com\/blog\/add-column-to-sales-order-history-page-magento-2\/","title":{"rendered":"How to Add Column to Customer Sales Order History Page in Magento 2"},"content":{"rendered":"\n<p class=\"wp-block-paragraph\">Magento 2 offers a \u201cMy Account\u201d section for the customers to check their details like account details, order and payment details, shipment, taxes, etc.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">It is always a good practice for online stores to deliver maximum information to the customers about their orders, payments, shipping, etc.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">With online shopping, until the customers do not get their items in hand, the urge to know about their order increases. The \u201cMy Account\u201d section in Magento 2 store answers such customers\u2019 questions.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Now, every business is different and has unique requirements. So, if you need to display any additional order details, you can do so with the below method to&nbsp;<strong><em>add column to customer sales order history page in Magento 2<\/em><\/strong>.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">And, if you need to display the order history in the admin panel, you can install Meetanshi\u2019s&nbsp;<a href=\"https:\/\/meetanshi.com\/magento-2-order-history.html\" target=\"_blank\" rel=\"noreferrer noopener\">Magento 2 Order History<\/a>&nbsp;extension to track any orders related to a product or customer.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Here\u2019s an example where the \u201cCustomer Note\u201d column is added and the sales order history page is customized for the same:<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img decoding=\"async\" src=\"https:\/\/meetanshi.com\/blog\/wp-content\/uploads\/2020\/07\/custom-colum-to-sales-order-history-page-magento-2.png\" alt=\"Custom Column to Customer Sales Order History Page in Magento 2\" class=\"wp-image-9815\"\/><\/figure>\n\n\n\n<h2 class=\"wp-block-heading\">Magento 2 Add Column to Customer Sales Order History Page<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">1. Create a file at path app\/code\/Vendor\/Module\/view\/frontend\/layout\/sales_order_history.xml<\/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;page xmlns:xsi=\"http:\/\/www.w3.org\/2001\/XMLSchema-instance\" xsi:noNamespaceSchemaLocation=\"urn:magento:framework:View\/Layout\/etc\/page_configuration.xsd\">\n&lt;body>\n    &lt;!-- This will add additional column header to order list -->\n    &lt;referenceBlock name=\"sales.order.history.extra.column.header\">\n        &lt;block name=\"vendor.additional.column.header\" template=\"Vendor_Module::extraColumn-header.phtml\"\/>\n    &lt;\/referenceBlock>\n\n    &lt;!-- You can access current order using $this->getOrder() inside the template \"-->\n    &lt;referenceBlock name=\"sales.order.history.extra.container\">\n        &lt;block name=\"vendor.additional.column.data\" template=\"Vendor_Module::extraColumn.phtml\"\/>\n    &lt;\/referenceBlock>\n&lt;\/body><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">2. Create template file at path app\/code\/Vendor\/Module\/view\/frontend\/templates\/extraColumn-header.phtml<\/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;?php\n    \/* @var $block \\Magento\\Sales\\Block\\Order\\History\\Container *\/\n   ?>\n   &lt;th data-th=\"&lt;?= $block->escapeHtml(__('Customer Note')) ?>\" class=\"col\">\n        &lt;?= $block->escapeHtml(\"Customer Note\") ?>\n   &lt;\/th><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">Create template file at path app\/code\/Vendor\/Module\/view\/frontend\/templates\/extraColumn.phtml<\/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;?php\n    \/* @var $block \\Magento\\Sales\\Block\\Order\\History\\Container *\/\n  ?>\n\n  &lt;td data-th=\"&lt;?= $block->escapeHtml(__('Customer Note')) ?>\" class=\"col\">\n    &lt;?= $block->escapeHtml($block->getOrder()->getCustomerNote()) ?>\n  &lt;\/td><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">That\u2019s it.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">By following the above method, you can easily add column to sales order history page (FO) in Magento 2. <\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Also, do share the solution with fellow Magento developers via social media.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Thank you.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Magento 2 offers a \u201cMy Account\u201d section for the customers to check their details like account details, order and payment details, shipment, taxes, etc. It&#8230;<\/p>\n","protected":false},"author":14,"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-1136","post","type-post","status-publish","format-standard","hentry","category-magento"],"acf":[],"_links":{"self":[{"href":"https:\/\/meetanshi.com\/blog\/wp-json\/wp\/v2\/posts\/1136","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\/14"}],"replies":[{"embeddable":true,"href":"https:\/\/meetanshi.com\/blog\/wp-json\/wp\/v2\/comments?post=1136"}],"version-history":[{"count":3,"href":"https:\/\/meetanshi.com\/blog\/wp-json\/wp\/v2\/posts\/1136\/revisions"}],"predecessor-version":[{"id":14774,"href":"https:\/\/meetanshi.com\/blog\/wp-json\/wp\/v2\/posts\/1136\/revisions\/14774"}],"wp:attachment":[{"href":"https:\/\/meetanshi.com\/blog\/wp-json\/wp\/v2\/media?parent=1136"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/meetanshi.com\/blog\/wp-json\/wp\/v2\/categories?post=1136"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/meetanshi.com\/blog\/wp-json\/wp\/v2\/tags?post=1136"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}