How to override order/history.phtml template in Magento 2?

You can override history.phtml file using layout XML by creating a module or directly add template file to the theme level under Magento_Sales module under the theme.

History.phtml file initiated by History.php Block class.

  • Using Theme level,


history.phtml file used for display list of Orders for a customer inside Customer Dashboard My Orders Section.

you can see My Orders page by URL, <SITE_URL>/sales/order/history

  • Using Module,

You need to create sales_order_history.xml file to add template,


<?xml version="1.0"?>
 * Order History layout
 * @author  Rakesh Jesadiya
 * @package Rbj_History
<page xmlns:xsi="" xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/page_configuration.xsd">
    	<referenceBlock name="sales.order.history" template="Rbj_History::order/history.phtml" />

Create history.phtml file,

Add Content from Sales Module history.phtml to your custom template and start modify based on your requirement.

Clear a cache and check your login page.