Hello Magento Friends,

In this blog, we will learn about getting store config value in Magento 2.

Magento stores all the configuration values in the core_config_data table. When you want to retrieve store config data, you can use the below steps.

Steps to Get Store Config Value in Magento 2:

Step 1: Create the system.xml file inside the etc folder

Path – Vendor/Extension/etc/adminhtml/system.xml     

Then add the code as follows

Step 2: Now create Data.php file inside the Helper folder

Path – Vendor/Extension/Helper/Data.php    

Then add the below code snippet

Note – You can inject the helper class anywhere and use the getConfig() function to get the config value.

Conclusion:

This way you can Get Store Config Value in Magento 2. If you have any doubts let me know through the comment part. Share the article with your friends and stay updated with us for the latest tutorials.

Happy Coding!

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