0

I'm going crazy. I've read a lot of tutorials and marked "as solved" topics on override template on sales email. I'm trying to customize the sales_email_order_items, so I've created a file in [ModuleDir]/view/frontend/layout/sales_email_order_items.xml

<?xml version="1.0"?>
<page xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/page_configuration.xsd">
    <body>
        <referenceBlock name="items">
            <block class="Magento\Sales\Block\Order\Email\Items"  template="Vendor_Module::email/items.phtml"/>
        </referenceBlock>
    </body>
</page>

and created my custom template in [ModuleDir]/view/frontend/templates/email/items.phtml cleared cache and compiled, but nothing has changed.

Someone can help me?

0

What you are doing in this code is adding a child block of Magento\Sales\Block\Order\Email\Items without any name to Magento\Sales\Block\Order\Email\Items block named "items". If you want to change the template of the "items" block the correct syntax is

<?xml version="1.0"?>
<page xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/page_configuration.xsd">
    <body>
        <referenceBlock name="items">
            <action method="setTemplate">
                <argument name="template" xsi:type="string">Vendor_Module::email/items.phtml</argument>
            </action>
        </referenceBlock>
    </body>
</page>
|improve this answer|||||

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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