How to get admin config values from a specific 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

$this->scopeConfig->getValue('your/path/config',\Magento\Store\Model\ScopeInterface::SCOPE_STORE,'store_code');

Tags:

Magento2