In this article, you going to see discussion regarding Magento 2 override order/history.phtml template in detail and step by step.
If you are looking for this topic then you are at right place.
Let’s start with the topic Magento 2 override order/history.phtml template
There are two ways by which you can override order history phtml.
Using layout XML file override order history section.
To do this, First you have to create module.
In module add layout xml file to override order history.
Below is the second method.
Also you can do overriding by adding template file to the theme level under
Magento_Sales module under the theme section.
With the help of Block class file called
History.php template file get initiated called
1) How you can do using Theme level?
Below is given path of template file under the theme section.
The main use of the history template file is to display the list of order for the customer.
It is inside Customer Dashboard My Orders Section.
This order page URL you can see as
2) How you can do using Module?
You just need to add template file under xml of created module.
Below is the path of the xml file from which you can understand.
<?xml version="1.0"?><!--/** * Order History layout * * @author Techone * @package Techone_History */--><page xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/page_configuration.xsd"> <body> <referenceBlock name="sales.order.history" template="Techone_History::order/history.phtml" /> </body></page>
Next step is create the template file name as
Below is path of the file.
Now you can add content in custom template.
In this way you can modify order history as per your requirement.
With the help of above code snippet one can do operation for Magento 2 override order history template file
I hope you like this article and if you have any query, please comment below.