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,

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

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

    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.