enter image description hereI'm developing a custom module in magento 2. I need to change the file located in Magento/Sales/view/Frontend/Templates/Email/Items/Order/default.phtml.

  • sorry @Rahul but I didn't find any file(order.phtml) under this location check it again. Feb 3, 2017 at 6:16
  • Are you kidding there is no file in this location can you provide screenshot ? Feb 3, 2017 at 6:29
  • @Ramkishan see this screenshot Feb 3, 2017 at 6:50
  • where is order.phtml ? there is default.phtml in order folder Feb 3, 2017 at 6:51
  • Now you have edit your question. Please provide right information so that we can give answer. Feb 3, 2017 at 6:53

2 Answers 2


You can override using below code in your module.

 <referenceBlock name="block_name" >
      <action method="setTemplate">
          <argument name="template" xsi:type="string">YourVendor_YourModuleName::email/items/order/default.phtml</argument>

block_name: should be default block name of order.phtml template is calling.


<referenceBlock name="customer_address_edit" >
        <action method="setTemplate">
            <argument name="template" xsi:type="string">Vendor_ModuleName::address/edit.phtml</argument>

in my case, i want to override edit.phtml. so customer_address_edit block name I have used.

EDIT add this code in your Vendor/Module/view/frontend/layout/sales_email_order_renderers.xml

<page xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/page_configuration.xsd" label="Email Creditmemo Items List" design_abstraction="custom">
    <referenceBlock name="sales.email.order.renderers">
      <action method="setTemplate">
        <argument name="template" xsi:type="string">YourVendor_Module::email/items/order/default.phtml</argument>

To overwrite a template all you need to do is add a template with the same file path to your theme, so adding the template to the location below should overwrite the template you want:


Read more about Magento 2's theme inheritance here - http://devdocs.magento.com/guides/v2.1/frontend-dev-guide/themes/theme-inherit.html

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.