Magento 2 – How to Override Admin Files

adminhtmlcoremagento-2.1magento2overrides

I need to add some modification on the following file so that i'm trying to overwrite the file in local

vendor/magento/module-sales/view/adminhtml/templates/order/view/info.phtml

to app/design/frontend/Vendor/theme/Magento_Sales/adminhtml/templates/order/view/info.phtml

also try app/design/frontend/Vendor/theme/Magento_Sales/adminhtml/templates/order/view/info.phtml
app/design/frontend/Vendor/theme/Magento_Sales/templates/adminhtml/order/view/info.phtml

But it seems not working…!

Best Answer

You Cannot Override Admin Files Directly In Your Theme. You Need Custom Module For Overriding Admin Files OR Use Existing Custom Module.

1) Copy vendor/magento/module-sales/view/adminhtml/templates/order/view/info.phtml

to app/code/Vendor/Module/view/adminhtml/templates/order/view/info.phtml

2) Create sales_order_view.xml at

app/code/Vendor/Module/view/adminhtml/layout/sales_order_view.xml

and add this code

<page xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/page_configuration.xsd">
    <body>
        <referenceBlock name="order_info">
            <action method="setTemplate">
                <argument name="template" xsi:type="string">Vendor_Module::order/view/info.phtml</argument>
            </action>
        </referenceBlock>
    </body>
</page>

3) Depending on your cache settings you may have to clear cache: php bin/magento cache:clear