Hello Magento Pals 👋,

Today I am going to demonstrate How to Add Dynamic System Configuration in Magento 2. Look at the previous topic, if you missed out, Magento 2: Add Swatch Data in Layered Navigation Aggregations in GraphQL.

System Configuration is a very useful aspect for Magento. Many times, Magento developers come across the requirement to add dynamic fields to system configuration to meet the store needs. Dynamic fields are used to manage complex data via system configurations. The admin can add, modify, and even delete the dynamic fields as per the necessity through system configuration.

So, let’s explore the steps to Add Dynamic System Configuration field in Magento 2 🚀

How to Add Dynamic System Configuration Field in Magento  2:

Step 1: Create one sample System.xml in the following path:

app/code/Vendor/Extension/etc/adminhtml/system.xml

Then, add the below code:

Step 2: To do this, create di.xml in the following path:

app\code\Vendor\Extension\etc\adminhtml\di.xml

Now, add the below code:

Step 3: Next, create a Plugin with name Data.php file in Plugin:

 app\code\Vendor\Extension\Plugin\Config\Field\Data.php

and add this code to the file:

It’s done!

You can check the output from the admin panel. It looks like below… 

Output:

add-dynamic-system-configuration-field-magento2

Concluding Words:

This way you can Add Dynamic System Configuration Field in Magento 2. Add your questions in the comment section and I will be glad to be of help. 

Relevantly, you may also like to read – 

Keep in touch, Keep rating and Keep sharing!

Happy Coding 😊

Click to rate this post!
[Total: 1 Average: 5]