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,

app/design/frontend/<ThemePackage>/themename/Magento_Sales/templates/order/history.phtml

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,

Path:
app/code/Rbj/History/view/frontend/layout/sales_order_history.xml

<?xml version="1.0"?>
<!--
/**
 * Order History layout
 *
 * @author  Rakesh Jesadiya
 * @package Rbj_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="Rbj_History::order/history.phtml" />
    </body>
</page>

Create history.phtml file,
Path:
app/code/Rbj/History/view/frontend/templates/order/history.phtml

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.