Currently, I'm getting my values like:

$this->_scopeConfig->getValue('settings/basics/language', \Magento\Store\Model\ScopeInterface::SCOPE_STORE);

But this, of course, gets me the default value.

How do I get the config value of a certain store view?


When you look into Magento\Framework\App\Config\ScopeConfigInterface in getValue() method

This method accept the 3 parameter

  • $path The path through the tree of configuration values e.g., 'general/store_information/name'
  • string $scopeType The scope to use to determine config value, e.g., 'store' or 'default'
  • null|string $scopeCode

So If you want to get store config by store wise then you just need to pass second (so you can define you want value as storewise or website) as well as third parameter (you can pass your store code here).

use Magento\Framework\App\Config\ScopeConfigInterface;

protected $scopeConfig;

public function __construct(
    ScopeConfigInterface $scopeConfig
) {
    $this->scopeConfig = $scopeConfig;

Now you can get store config value by

| improve this answer | |

You can get value from specific store by passing third parameter which is store code define in Magento\Framework\App\Config\ScopeConfigInterface class.

public function getValue($path, $scopeType = ScopeConfigInterface::SCOPE_TYPE_DEFAULT, $scopeCode = null);
| improve this answer | |
    protected $_scopeConfig;

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

    $storeScope = \Magento\Store\Model\ScopeInterface::SCOPE_STORES;
    $this->_scopeConfig->getValue("section_id/group_id/field_id", $storeScope);

section_id, group_id, field_id values you can find in etc/adminhtml/system.xml path in your custom / (default vendor) Module

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.