I want to get a config value from core_config but the default level I know we can get it by using scope config but I want default

1 Answer 1

protected $_scopeConfig;

    public function __construct(\Magento\Framework\App\Config\ScopeConfigInterface $scopeConfig) {
        $this->_scopeConfig = $scopeConfig;
$this->scopeConfig->getValue('example_section/general/field_data', \Magento\Store\Model\ScopeInterface::SCOPE_STORE);

When you give SCOPE_STORE it will give you default value

  • Thank you I will take a look at this and test it out Commented Sep 25, 2019 at 20:52

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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