---
title: "How to Get Store Config Value in Magento 2"
url: "https://magecomp.com/blog/get-store-config-value-magento-2/"
date: "2022-10-03T10:00:02+00:00"
modified: "2025-02-13T11:53:32+00:00"
author:
  name: "Dhiren Vasoya"
  url: "https://magecomp.com/"
categories:
  - "How To"
  - "Magento 2"
word_count: 316
reading_time: "2 min read"
summary: "Hello Magento Friends,"
description: "You can easily get the store config value using the getConfig() function in Magento 2. Learn more"
keywords: "How To, Magento 2"
language: "en"
schema_type: "Article"
related_posts:
  - title: "How to Fix Magento Form Key Auto Disable Issue at Checkout Page"
    url: "https://magecomp.com/blog/fix-magento-form-key-auto-disable-issue-at-checkout-page/"
  - title: "How to Show/Hide Order ID in Invoice, Shipment &#038; Credit Memo PDF of Magento 2"
    url: "https://magecomp.com/blog/show-hide-order-id-in-invoice-shipment-credit-memo-pdf-of-magento-2/"
  - title: "7 Things to Know before you Create Magento 2 Migration Plan"
    url: "https://magecomp.com/blog/7-things-to-know-before-you-create-magento-2-migration-plan/"
---

# How to Get Store Config Value in Magento 2

_Published: October 3, 2022_  
_Author: Dhiren Vasoya_  

![How to Get Store Config Value in Magento 2](https://magecomp.com/blog/wp-content/uploads/2022/10/How-to-Get-Store-Config-Value-in-Magento-2-1024x512.webp)

**Hello Magento Friends,**

In this blog, we will learn about getting store config value in Magento 2.
[![hyva theme development](https://magecomp.com/blog/wp-content/uploads/2025/02/hyva-theme-development-CTA-4.webp)](https://magecomp.com/services/hyva-theme-development/)

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
```
<?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>
                    <label>Custom Settings</label>
            <group id="custom_group_id" translate="label" type="text" sortOrder="1" showInDefault="1" showInWebsite="1" showInStore="1">
                <label>Main label</label>
                <field id="custom_field_id" translate="label" type="text" sortOrder="30" showInDefault="1" showInWebsite="1"  showInStore="1">
                    <label>Field Name</label>
                </field>
            </group>
            </system>
</config>
```

[![Hire Magento Programmer](https://magecomp.com/blog/wp-content/uploads/2025/02/Hire-Magento-Programmer-CTA-4.webp)](https://magecomp.com/services/hire-magento-programmer/)

**Step 2:** Now create **Data.php** file inside the Helper folder
Path – **Vendor/Extension/Helper/Data.php**
Then add the below code snippet
```
<?php
namespace VendorExtensionHelper;
use MagentoStoreModelScopeInterface;
use MagentoFrameworkAppHelperAbstractHelper;

class Data extends AbstractHelper
{
   const XML_CONFIG_PATH = 'custom/custom_group_id/custom_field_id';

   public function getConfig()
    {
        $configValue = $this->scopeConfig->getValue(self::XML_CONFIG_PATH,ScopeInterface::SCOPE_STORE);
        return $configValue;
    }
}
```

**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.
[![Magento version upgrade](https://magecomp.com/blog/wp-content/uploads/2025/02/Magento-2-Version-Upgrade-CTA-2.webp)](https://magecomp.com/services/magento-upgrade-services/)

**Happy Coding!**


---

_View the original post at: [https://magecomp.com/blog/get-store-config-value-magento-2/](https://magecomp.com/blog/get-store-config-value-magento-2/)_  
_Served as markdown by [Third Audience](https://github.com/third-audience) v3.5.3_  
_Generated: 2026-10-13 13:59:45 UTC_  
