Magento2 get store config value

By | May 11, 2016

Store Config value which help us to get the value directly from System Configuration.

Just get the object of ScopeConfigInterface and the we can use in way as mentioned below

protected $scopeConfig;

public function __construct(
\Magento\Framework\App\Config\ScopeConfigInterface $scopeConfig
) {
$this->scopeConfig = $scopeConfig;
}

We can use in our Function
$this->_scopeConfig->getValue(
‘carriers/shipper/active’,
\Magento\Store\Model\ScopeInterface::SCOPE_STORE);

 

Hope this will help you.

Leave a Reply