Magento 2 – How to Override Admin Template File

adminmagento2overrides

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?

Best Answer

Try following way:

Vendor/Module/view/adminhtml/layout/sales_order_view.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>
        <referenceBlock name="column_name">
            <action method="setTemplate">
                <argument name="template" translate="true" xsi:type="string">Vendor_Module::order/items/column/name.phtml</argument>
            </action>
        </referenceBlock>
    </body>
</page>

Copy original file into following location:

Vendor/Module/view/adminhtml/templates/order/items/column/name.phtml

Clear cache.