I have default.xml overridden into my custom_theme but is actually an empty file(need not worry about the content). I want to prevent magento 2 from calling this empty file so as to improve the system performance from the optimization perspective. Please help. Thanks in advance!!

1 Answer 1


There is no need to prevent Magento to load your overrided layout, that would be against logic and this is what we call: Magento Fallback System.

Since you have placed your default.xml in your current theme, it means that you tell to Magento take this file first, and after you want to tell him don't take it ! it doesn't make sense.

When you override or extends some layout, according to the Magento Fallback System, Magento collects layout files in the following order:

  1. Current theme layouts: <theme_dir>/<Vendor>_<Module>/layout/

  2. Ancestor themes layouts, starting from the most distant ancestor, recursively until a theme with no parent is reached: <parent_theme_dir>/<Vendor>_<Module>/layout/

  3. Module layouts for the frontend area: <module_dir>/view/frontend/layout/

  4. Module layouts for the base area: <module_dir>/view/base/layout/

So if you don't want Magento load your default.xml file, remove it, it has no utility and still less impact on performances.

More informations in Magento Devdocs

  • Yes absolutely, got your point. Assume that I have removed my overriding file then how do I prevent the call to the original default.xml present in the module. I had overridden the particular file to remove a block but nevertheless, the file becomes empty. Overriding is for the reason so that changes remain intact on system upgrade. But now I realize the fact to not override the file, but not give a call itself to achieve the functionallity which I would achieve by commenting a snippet.
    – YDF
    Aug 27, 2018 at 8:57

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.