Make Default System Config Value In Magento 2

In the previous article, we learned about Add Custom Category Attributes In Magento 2. Today, we will introduce you about Make default system config value in Magento 2.

I think you should read How To Create New Theme In Magento 2 first.

Find path config

We’ll make default system config value for our module. Please see file app/code/<vendor_name>/<module_name>/etc/adminhtml/system.xml

code section group value

The path config is section/grounp/value

Make default system config

Now, we’ll create file app/code/<vendor_name>/<module_name>/etc/config.xml should look like:

<?xml version="1.0"?>
<config xmlns:xsi="" xsi:noNamespaceSchemaLocation="urn:magento:module:Magento_Store:etc/config.xsd">
        <themes><!-- section_id -->
            <general><!-- group_id -->
                <wellcome_text>Hi, Guest!</wellcome_text><!-- field_id -->
                <enable_topbanner>1</enable_topbanner><!-- field_id -->
                <background_image>default/forage-grass_landing-page_1600x300-1600x300_1.png</background_image><!-- field_id -->

This code will make default system config value when you install module.

Good luck!

This is Make default system config value in Magento 2.

Follow us for more helpful tutorial!

We hope this is useful blog for you.

Thank you for reading!

4 1 vote
Article Rating

Adam Roger

CEO and Founder of Magetop. A friend, a husband and a dad of two children. Adam loves to travel to experience new cultures and discover what is happening with ecommerce all around the world.

Leave a Reply or put your Question here

Inline Feedbacks
View all comments
Would love your thoughts, please comment.x