I'm developing a custom module in magento 2. I need to change the file located in Magento/Sales/view/Adminhtml/Templates/Items/Column/name.phtml.

How can I override file in custom extension?


Try following way:


<?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">
        <referenceBlock name="column_name">
            <action method="setTemplate">
                <argument name="template" translate="true" xsi:type="string">Vendor_Module::order/items/column/name.phtml</argument>

Copy original file into following location:


Clear cache.

  • 2
    Beware that using action tag is no longer recommended, you should use <referenceBlock name="column_name" template="Vendor_Module::order/items/column/name.phtml"/> – Rendy Eko Prastiyo Feb 2 '17 at 7:33
  • Don't worry, look here github.com/magento/magento2/issues/3356 – Sohel Rana Feb 2 '17 at 7:55
  • What if the file does not have a layout and it is set in code. Like magento/module-payment/view/adminhtml/templates/info/substitution.phtml – stephen May 11 '17 at 14:04
  • @StevieG you can overwrite any template by replacing your own theme, or overwrite Block class and set $_template variable or this answer. – Sohel Rana May 11 '17 at 14:49

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.