I have the template that is using the following to render order summary
{{layout handle="sales_email_order_items" order=$order area="frontend"}}
it is taking the code from the following template
/app/design/frontend/Corra/Mytheme/Magento_Sales/templates/email/items/order/default.phtml
So I want to override this file with my custom module file and use this one.
I created a module "Corra_Sales"
I put the .phtml here
/app/code/Corra/Sales/view/frontend/templates/email/items/order/default.phtml
Also, I created the layout with the file:
/app/code/Corra/Sales/view/frontend/layout/sales_email_order_renderers.xml
The code inside file is:
<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">
<body>
<referenceBlock name="sales.email.order.renderers">
<block class="Magento\Sales\Block\Order\Email\Items\Order\DefaultOrder" as="default" template="Corra_Sales::email/items/order/default.phtml"/>
</referenceBlock>
</body>
</page>
Also, I tried with :
<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">
<body>
<referenceBlock name="sales.email.order.renderers">
<arguments>
<argument name="template" xsi:type="string">Corra_Sales::email/items/order/default.phtml</argument>
</arguments>
</referenceBlock>
</body>
</page>
I clear cache, remove var folder, rebuild, etc.
But it still not working, someone could tell me what I am doing wrong that always take this file ->?
/app/design/frontend/Corra/Mytheme/Magento_Sales/templates/email/items/order/default.phtml
This worked for me under 2.2.5 your module file needs to state the sequence to follow Vendor/ModuleExample/etc/module.xml
You also need to take into consideration that the block does not have a name, so you might want to use the alias.
Let me know if it helped.
Sources: https://magento.stackexchange.com/questions/177343/override-magento-2-email-items-order-default-phtml https://www.classyllama.com/blog/template-override-m2