How to get Store System Configuration value in magento2:
Below script will helpful to return the store config value. We usually configure custom fields from System configuration section. Using with below code we can retrieve those values.
class MyModel extends \Magento\Framework\Model\AbstractModel{ protected $_scopeConfig; public function __construct( \Magento\Framework\View\Element\Template\Context $context, \Magento\Framework\App\Config\ScopeConfigInterface $scopeConfig, array $data = [] ) { parent::__construct($context, $data); $this->_scopeConfig = $scopeConfig; } public function getMyValue(){ $myvalue = $this->_scopeConfig->getValue('general/store_information/mystoreconfigname', \Magento\Store\Model\ScopeInterface::SCOPE_STORE); return $myvalue; } }
CORNER OF BLOG: