1

I am trying to override Magento_Sales::email/items/shipment/default.phtml
Here is my layout file app/code/Mod/Sales/view/frontend/layout/sales_email_order_shipment_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.shipment.renderers">
            <action method="setTemplate">
                <argument name="template" xsi:type="string">Mod_Sales::email/items/shipment/default.phtml</argument>
            </action>
        </referenceBlock>
    </body>
</page>

Added phtml in

app/code/Mod/Sales/view/frontend/templates/email/items/shipment/default.phtml

But file did not override the call still comes into vendor file. Any thoughts what's missing ?

1
  • Any thoughts on this ?
    – devhs
    Feb 18, 2021 at 10:45

1 Answer 1

0

Try This

sales_email_order_shipment_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.shipment.renderers.default">
            <action method="setTemplate" >
                <argument name="template" xsi:type="string">Mod_Sales::email/items/shipment/default.phtml</argument>
            </action>
        </referenceBlock>

        <referenceBlock name="sales.email.order.shipment.renderers.grouped">
            <action method="setTemplate" >
                <argument name="template" xsi:type="string">Mod_Sales::email/items/shipment/default.phtml</argument>
            </action>
        </referenceBlock>

        <referenceBlock name="sales.email.order.shipment.renderers.bundle">
            <action method="setTemplate" >
                <argument name="template" xsi:type="string">Mod_Sales::email/items/shipment/default.phtml</argument>
            </action>
        </referenceBlock>

        <referenceBlock name="sales.email.order.shipment.renderers.downloadable">
            <action method="setTemplate" >
                <argument name="template" xsi:type="string">Mod_Sales::email/items/shipment/default.phtml</argument>
            </action>
        </referenceBlock>
    </body>
</page>
15
  • Hello, is their any specific reason why override these many referenceBlock ?
    – devhs
    Feb 18, 2021 at 7:44
  • because of there are multiple type of product to show into email that's why we override these many referenceBlock.
    – Msquare
    Feb 18, 2021 at 8:21
  • ok thanks let me check the answer.
    – devhs
    Feb 18, 2021 at 8:22
  • ok check and update me.
    – Msquare
    Feb 18, 2021 at 8:38
  • you can get product id from this item obj. And load product by that product id.
    – Msquare
    Feb 18, 2021 at 8:40

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.