Skip to main content

Magento2 Configuration values per deafferent scopes

in order to get any value per specific scope you can use the below parameters 

First you need to initialize scopeConfig


 * @var \Magento\Framework\App\Config\ScopeConfigInterface
protected $_scopeConfig;


in the constrructer of your class 

     * Setting constructor.
     * @param \Magento\Framework\App\Config\ScopeConfigInterface $scopeConfig
    public function __construct(
        \Magento\Framework\App\Config\ScopeConfigInterface $scopeConfig
    ) {
        $this->_scopeConfig = $scopeConfig;



then you can use any of those values 

  • \Magento\Store\Model\ScopeInterface::SCOPE_STORE
  • \Magento\Store\Model\ScopeInterface::SCOPE_GROUP
  • \Magento\Store\Model\ScopeInterface::SCOPE_WEBSITE


this->_scopeConfig->getValue({config-code}, \Magento\Store\Model\ScopeInterface::SCOPE_STORE);