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!