8

I try to override

vendor\magento\module-multishipping\view\frontend\templates\checkout\addresses.phtml

I create the layout

app\code\My\CustomModule\view\frontend\layout\multishipping_checkout_addresses.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>
        <referenceContainer name="content">
            <block class="Magento\Multishipping\Block\Checkout\Addresses" name="checkout_addresses" template="My_CustomModule::checkout/addresses.phtml" cacheable="false">
            </block>
        </referenceContainer>
    </body>
</page>

And the template

app\code\My\CustomModule\view\frontend\templates\checkout\addresses.phtml

<h1>It works </h1>

It doesn't work... Please help me! Thanks.

ViSuaL
  • 281
  • 2
  • 4
  • 16

2 Answers2

7
<referenceBlock name='copyright'>
    <action method='setTemplate'>
        <argument name='template' xsi:type='string'>Dfr_Backend::page/copyright.phtml</argument>
    </action>
</referenceBlock>
Brad Larson
  • 170,088
  • 45
  • 397
  • 571
Dmitrii Fediuk
  • 434
  • 9
  • 11
  • 1
    What is "Dfr_Backend" and why is that in EVERY example of how to change a template but it's NEVER explained? Is that a custom module? What if I want to override a template in my theme but I don't have a custom module, where do I put it then and what's the syntax? – Mageician Jun 01 '18 at 00:52
  • `Dfr_Backend` is a custom module which contains the new (custom) template. You should specify your module name instead of `Dfr_Backend`. – Dmitrii Fediuk Jun 08 '18 at 04:30
  • 5
    why you change the name of the example. it's easier if you put the answer based on the example – Ezequiel De Simone Sep 18 '18 at 20:35
2

The <action> instruction is deprecated. You can also use:

<referenceBlock name="form.subscribe" template="{Vendor_Module}::newsletter/subscribe.phtml" />
Altravista
  • 357
  • 3
  • 12