How to override below admin file in my custom admin theme ?


Front-end and Back-end theme have same file structure.For customize or change something from the parent theme all you need to do is copy the file you want to change (layout, template) to your theme from the specific module and do your changes.

Points to remember:

  • To create the back-end/front-end theme, you need to create a new module
  • To apply front-end theme you can active from back-end.

Reference: http://devdocs.magento.com/guides/v2.2/frontend-dev-guide/themes/theme-apply.html

  • To apply back-end theme you need to specify in etc/di.xml file

Reference: http://devdocs.magento.com/guides/v2.2/frontend-dev-guide/themes/admin_theme_apply.html

1. How to create admin theme

create theme.xml: file in app/design/adminhtml/<yourpackage>/<yourtheme>/theme.xml

<theme xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:Config/etc/theme.xsd">
    <title>My Theme Tile</title>

Register theme : create registration.php in app/design/adminhtml/<yourpackage>/<yourtheme>/registration.php


module.xml: in app/design/adminhtml/<yourpackage>/<yourtheme>/theme.xml and sequence xml element to make sure your theme gets loaded last.

    <module name="<yourpackage>_<yourtheme>" setup_version="1.0.0">
            <module name="Magento_Theme"/>

Enable theme:

etc/di.xml: app/design/adminhtml/<yourpackage>/<yourtheme>/etc/di.xml

<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
<type name="Magento\Theme\Model\View\Design">
            <argument name="themes" xsi:type="array">
                <item name="adminhtml" xsi:type="string">yourpackage/yourtheme</item>

enter image description here

Now run php bin/magento setup:upgrade and php bin/magento setup:static-content:deploy from your magento root directory


Now theme all set come to customize part if you need to change any file just copy from Magento_root_directory\vendor\magento\ for frontend and back-end.


Override sales order view page : just need to create xml file in your module to override.

app/code/{yourpackage}/{yourtheme}/view/adminhtml/layout/sales_order_view.xml copy from Magento-root-directory\vendor\magento\module-sales\view\adminhtml\layout\sales_order_view.xml

<referenceBlock name='order_info'>
    <argument name='template' xsi:type='string'>Vendor_Module::order/view/info.phtml</argument>

Don't forget to add Load custom module layout after sales


        <module name="Magento_Sales"/>

and all changes here..


  • Thanks for reply. do you have any idea how to create and apply custom admin theme in backend Apr 27 '18 at 5:35
  • I have created devdocs.magento.com/guides/v2.2/frontend-dev-guide/themes/… this way but didn;t apply my theme in admin Apr 27 '18 at 5:44
  • Do we need to create module.xml in app/design/adminhtml/Vendor/Themename/module.xml and etc/di.xml in app/design/adminhtml/Vendor/Themename/etc/di.xml Apr 27 '18 at 6:01
  • Create a separate MyVendor_MyBackendTheme module and specify in '<module>/etc/di.xml' Apr 27 '18 at 6:05
  • @hweb87 The steps are the same, but instead of frontend use adminhtml in the folder structure. Apr 27 '18 at 6:21

Try app/design/adminhtml/<Vendor>/<admin_theme>/Magento_Sales/templates/order/view/info.phtml

You can read on how to create an admin theme at http://devdocs.magento.com/guides/v2.1/frontend-dev-guide/themes/admin_theme_create.html


Create app/design/frontend/Vendor_Name/Theme_Name/Magento_Sales/templates/order/view/info.phtml in your custom admin theme.

Hope this helps you.

  • No, we can't edit in module-sales Apr 27 '18 at 5:34
  • Add info.phtml in your custom theme at module-sales/templates/order/view/info.phtml We are overriding the core template. Apr 27 '18 at 5:45

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.