How to Get System Configuration Value?

0

Today’s topic is How to get value from system configuration programmatically.

So, let’s take some basic overview regarding system configuration.
Using system configuration admin can store the value based on the website wise, store wise and store view wise and all those values are stored in the core_config_data table.

To get the value from the table you can call the getConfig() method function.

We just simply create object manager which inject below class:
\Magento\Framework\App\Config\ScopeConfigInterface
After injecting to get the value store wise we need the second parameter as store scope.

$objectManager = \Magento\Framework\App\ObjectManager::getInstance();
$ScopeConfigInterface = $objectManager->get('\Magento\Framework\App\Config\ScopeConfigInterface');
		
$storeScope = \Magento\Store\Model\ScopeInterface::SCOPE_STORE;
$storename = $ScopeConfigInterface->getValue('general/store_information/name', $storeScope);

Thanks for reading this post!

About the author

I’m Magento Certified Developer having quite 5 years of commercial development expertise in Magento as well as in Shopify. I’ve worked primarily with the Magento and Shopify e-commerce platform, managing the complexities concerned in building e-commerce solutions tailored to a client’s specific desires.

Related Posts

Leave a Reply