1

Before marking as duplicate go through once

I'm facing issue with overriding module-sales/view/frontend/templates/email/shipment/track.phtml

I'm using Magento 2.3.3

Answer is here but its not working. Overriding track.phtml in Magento2

I can able to override within my theme but I want some customization I would like to override with module.

I tried below:

Vendor_Module/view'frontend/layout/sales_email_order_shipment_track.xml

<page xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/page_configuration.xsd">
    <update handle="sales_email_order_shipment_renderers"/>
    <body>
        <block class="Magento\Framework\View\Element\Template" name="sales.order.email.shipment.track" template="Vendor_Module::email/shipment/track.phtml">
            <arguments>
                <argument name="tracking_url" xsi:type="object">Magento\Sales\Block\DataProviders\Email\Shipment\TrackingUrl</argument>
            </arguments>
        </block>
    </body>
</page>

I tried wrapping block within referenceContainer='content' but still not working.

UPDATE

Make sure you check send email copy to customer while generating shipment.

NO solution worked for me provided in comments. Any other solutions ?

But doesn't seems to work for me. Any ideas ?

8
  • 1
    The solution you implemented worked fine for me. Make sure you copied the "email/shipment/track.phtml" template into your extension "templates" folder and also try to regenerate the "pub/static/" content by performing a deploy. – Alex Constantinescu Apr 1 '20 at 17:09
  • 1
    comment <update handle="sales_email_order_shipment_renderers"/> this from your layout and check – Msquare Apr 2 '20 at 2:47
  • 1
    If your issue is overriding template in module, have you tried, <action method="setTemplate"> in xml? – Korbin Apr 2 '20 at 5:25
  • 1
    try this way magento.stackexchange.com/questions/308043/… – Msquare Apr 5 '20 at 6:31
  • @AlexConstantinescu I did have you tried with Magento 2.3.3 CE and make sure while generating shipment you check "Email copy to customer". yes I copied template to my module also but not working. – anonymous Apr 5 '20 at 10:22
0

Sorry can't comment, don't post much on Magento Exchange. I read through the comments. Have you read through this ticket? Make sure if you are doing a hard override you are properly including track.phtml. You might consider doing what they did and do a hard override. override the track.phtml template

1
  • Yes, I did same thing copied file to exact location as defined in my custom layout. What's that xml part that I didn't get. – anonymous Apr 8 '20 at 7:27

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.