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

You can override recent.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.

recent.phtml file used to show recently placed orders, on My Account Dashboard for registred customer with Section Name, Recent Orders at bottom of the page.

recent.phtml file is declared under the customer_account_index.xml file in Sales Module.

  • Using Theme level,

    you can see recento order by URL, <SITE_URL>/customer/account

    You need to override customer_account_dashboard_top Block file to change template data,You need to create customer_account_index.xml file to add template,


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

    Create recent.phtml file,

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

    Clear a cache and check your login page.