Cookies setting

Cookies help us enhance your experience on our site by storing information about your preferences and interactions. You can customize your cookie settings by choosing which cookies to allow. Please note that disabling certain cookies might impact the functionality and features of our services, such as personalized content and suggestions. Cookie Policy

Cookie Policy
Essential cookies

These cookies are strictly necessary for the site to work and may not be disabled.

Information
Always enabled
Advertising cookies

Advertising cookies deliver ads relevant to your interests, limit ad frequency, and measure ad effectiveness.

Information
Analytics cookies

Analytics cookies collect information and report website usage statistics without personally identifying individual visitors to Google.

Information
mageplaza.com

Magento 2 Module load order position

Vinh Jacker | 03-17-2025

Magento 2 Module load order position

Magento 2 Module load order position is the topic to point you to the right load order in your component’s module.xml file.

Highlight Contents

What is Magento 2 Module load order position?

Magento 2 Module Sequence - load order position is the topic to point you the right load order in your component’s module.xml file. If you want to understand the dependencies among the components using your component’s composer.json, it is obviously that you really need to know the correct load order in your component’s module.xml file using the <sequence> tag.

What is the <sequence> tag?

The responsibility of the <sequence> tag is notifying you that what components have to loaded before the current component is loaded. The <sequence> is especially supported when you implement the loading of different types of file such as configuration files, view files (including CSS, LESS, and template files), or setup classes.

In addition, if you need to load the regular classes (non-setup classes), there is no influence of the <sequence> tag on that implementation.

Note: The classes are called as setup classes when they are included by the component that creates or updates database schema or data.

To run your project fluently, you should use composer.json and <sequence> in module.xml file if ensuring that your needed component’s logic rely upon another component.

Module Sequence Cases

Here we will refer to Component A and Component B. Suppose that Component A introduces gadgetlayout.xml, which allows updating block gadgetBlock from component B. At that time, you need to clarify that in component B’s <sequence> entry in module.xml file. So now we will start with component A which needs a configuration file from component B.

  • Case 1: The files, which come with the same type, will be loaded from various components while the sequence information in each component’s module.xml file are considered as well.

  • Case 2: Suppose that you need to load a list of the layout files with the name default.xml and component A designates component B in <sequence>. The following is the load order of the files:

    • component X /view/frontend/layout/default.xml — Either we don’t care about when component X loads or perhaps component B requires it to be loaded before it.
    • component B /view/frontend/layout/default.xml
    • component A /view/frontend/layout/default.xml —Loads after component B because component B is listed in component A’s tag.
    • component Z /view/frontend/layout/default.xml — Either we don’t care about the sequence for component Z or perhaps component Z requires component A files to be loaded before it.

Maybe you need to know, in <sequence> tag, you can mention any valid component without any limitation and besides, you also should be sure that that component is declared in the require section of the composer.json file.

Final words

That’s all about Magento 2 Module Load order position. I hope this article helps you understand the sequence of Magento 2 Module load order position. If you have any doubts about this topic, feel free to let me know.

Thank you for reading!

Related Topics

x
    Jacker

    Jacker is the Chief Technology Officer (CTO) at Mageplaza, bringing over 10 years of experience in Magento, Shopify, and other eCommerce platforms. With deep technical expertise, he has led numerous successful projects, optimizing and scaling online stores for global brands. Beyond his work in eCommerce development, he is passionate about running and swimming.



    Related Post

    Website Support
    & Maintenance Services

    Make sure your store is not only in good shape but also thriving with a professional team yet at an affordable price.

    Get Started
    mageplaza services