Here is code for get current store in magento 2:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 |
protected $_storeManager; public function __construct( \Magento\Framework\View\Element\Template\Context $context, \Magento\Store\Model\StoreManagerInterface $storeManager, array $data = [] ) { parent::__construct($context, $data); $this->_storeManager = $storeManager; } public function getCurrentStore(){ return $this->_storeManager->getStore(); // give the information about current store } |