1

Is their any way we can override below template file

Magento_Sales::email/items/order/default.phtml

which is defined in

vendor/magento/module-gift-card/view/frontend/layout/sales_email_order_renderers.xml

in module ?

I have tried - Vendor/Sales/view/frontend/layout/sales_email_order_renderers.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" label="Email Creditmemo Items List" design_abstraction="custom">
    <body>
        <referenceBlock name="sales.email.order.renderers.default">
            <action method="setTemplate" >
                <argument name="sales.email.order.renderers.default" xsi:type="string">Vendor_Sales::email/items/order/default.phtml</argument>
            </action>
        </referenceBlock>
        <referenceBlock name="sales.email.order.renderers">
            <action method="setTemplate" >
                <argument name="sales.email.order.renderers.giftcard" xsi:type="string">Vendor_Sales::email/items/order/default.phtml</argument>
           </action>
        </referenceBlock>
    </body>
</page>

but then the file for "sales.email.order.renderers.default" block did not override.

0

3 Answers 3

0

"setTemplate" replacing the template for given block in your "Vendor_Sales" module layout file. So original file override will not reflect.

2
  • Thanks for the answer, is their any other way ?
    – devhs
    Commented Mar 11, 2021 at 10:08
  • @devhs can you please explain a bit more what final output you are expecting(purpose of the override). Commented Mar 11, 2021 at 10:36
0

Try adding it like this:

Override template file in your theme

app/design/frontend/{{vendor_namespace}}/{{theme_name}}/Magento_Sales/templates/email/items/order/default.phtml
1
  • Thanks for the answer, but i am not using theme
    – devhs
    Commented Mar 11, 2021 at 10:13
0
<?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="category.products.list">
            <action method="setTemplate">
                <argument name="template" xsi:type="string">vendor_module::product/list.phtml</argument>
            </action>
        </referenceBlock>
    </body>
</page>

Your Answer

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

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