🔥 Just Launched! Werra Premium Template for HyväSee it in Action

How to Create System.xml Configuration In Magento 2

By Sanjay JethvaUpdated on May 22, 2025 2 min read

Magento 2 is a feature-rich platform with default functionalities suitable for E-commerce businesses. However, with the evolving nature of shopping online and types of businesses, the default Magento 2 falls short. Fortunately, due to the customization capability of the platform, the store owners can use Magento 2 extensions to implement additional functionalities.

Now, there are many extensions where the store owner or admin has to configure a few settings and for which one needs to create system.xml configuration in Magento 2.

Allow the admin to flexibly configure the module by offering fields at Admin Panel > Stores > Configuration.

Example:

System.xml

Create system.xml configuration file in Magento 2 with the below code:

Steps to create system.xml configuration in Magento 2:

Create system.xml file at appcodeVendorExtensionetcadminhtml

<?xml version="1.0"?>
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
        xsi:noNamespaceSchemaLocation="urn:magento:module:Magento_Config:etc/system_file.xsd">
    <system>
        <tab id="vendor" translate="label" class="vendor" sortOrder="100">
            <label>vendor</label>
        </tab>
        <section id="extension" translate="label" type="text" sortOrder="40" showInDefault="1" showInWebsite="1"
                 showInStore="1">
            <class>separator-top</class>
            <label>Extension</label>
            <tab>vendor</tab>
            <resource>Vendor_Extension::config_extension</resource>
            <group id="general" translate="label" type="text" sortOrder="20" showInDefault="1" showInWebsite="1"
                   showInStore="1">
                <label>Configuration</label>
                <field id="enable" translate="label comment" type="select" sortOrder="10" showInDefault="1"
                       showInWebsite="1" showInStore="1">
                    <label>Extension Enable</label>
                    <source_model>Magento\Config\Model\Config\Source\Enabledisable</source_model>
                </field>
            </group>
        </section>    
    </system>
</config>

That’s it.

Please share the solution with fellow Magento developers via social media.

Thank you.

Sanjay Jethva Full Image
Article bySanjay Jethva

Sanjay is the co-founder and CTO of Meetanshi with hands-on expertise with Magento since 2011. He specializes in complex development, integrations, extensions, and customizations. Sanjay is one the top 50 contributor to the Magento community and is recognized by Adobe. His passion for Magento 2 and Shopify solutions has made him a trusted source for businesses seeking to optimize their online stores. He loves sharing technical solutions related to Magento 2 & Shopify.