3

How to override layout file, which is already override by other theme.

For example, we have existing theme.

app\design\frontend\<Vendor>\<themeone>\Module_Vendor\layout\override\base\somel_ayout.xml

How to override somel_ayout.xml file in my current theme.

Help would be appreciated.

5
  • Does your theme inherit from the other theme? Either way, you should be able to follow the same pattern as the first theme. devdocs.magento.com/guides/v2.0/frontend-dev-guide/layouts/…
    – Ash Smith
    Feb 16, 2017 at 10:09
  • Yes, it is not working even my current theme parent theme is <Vendor>\<themeone>, and i have already referred official Magento 2 documentation. Feb 16, 2017 at 10:12
  • it won't override but extend other theme xml file
    – klict
    Feb 16, 2017 at 10:33
  • @klict Can you tell me how to extend. Feb 16, 2017 at 10:41
  • can you precise what do you aim by saying override ? is it replacing totally the layout or adding some customisation ? Feb 16, 2023 at 18:17

2 Answers 2

0

Try to change your etc/module.xml file to define your priority file (module/theme):

<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:Module/etc/module.xsd">
    <module name="Vendor_Module" setup_version="1.0.0">
        <sequence>
            <module name="Vendor_Test" />
            <module name="Magento_Customer" />
        </sequence>
    </module>
</config>
0

if you want to override a layout file, create the same folder structure in the theme as in module's view/frontend. if the layout is placed in:

Vendor_ModuleName/view/frontend/layout/some_layout.xml

then place the file with which you want to override in:

app/design/frontend/[Vendor]/[Theme_Name]/Vendor_ModuleName/layout/some_layout.xml

If your xml is not created properly or contains any error. In this case it will follow the fallback technique.

3
  • above technique will work only when the layout exists in any module. If it does, and then overridden in themeone , you can override it in your themetwo by using the same. Feb 17, 2017 at 2:37
  • Please read the question, i want to override a layout file already overrided by theme override/base. Is there any technique to achieve this by new theme ? if yes, Please provide the example. Feb 17, 2017 at 5:56
  • 1
    can you post the snap of the directory structure of this particular theme. I will try to provide the solution. Feb 17, 2017 at 9:20

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.