We are struggling since hours with customization of the Order– and other sales emails. The part with the email templates (e.g. order_new_guest.html
etc.) works easily fine.
However, we do not succeed in modifying items.phtml
.
We did
– generate a xml sales_email_order_items.xml
in <mytemplate>/Magento_Sales/layout
- tried to reference our items.phtml with
<action method="setTemplate">
- written items.phtml in
<mytemplate>/Magento_Sales/email
but we don't get any change in the emails.
Probably, this is because we don't locate the .xml file in the proper directory? How do we have to reference our items.phtml within this xml-File?
And which directory do we put the items.phtml in?
We have understood lots of thing in Magento theme inheritance during the last weeks… but email templates seem to be the next stage 🙁
Best Answer
The way I achieved this is by creating a file called items.phtml here:
No XML file necessary. The path to items.phtml is defined in the Magento_Sales module: vendor/magento/module-sales/view/frontend/layout/sales_email_order_items.xml
You can use this code to test a New order email and you should see the TESTING TEMPLATE and TESTING SKU text appear: