2

Your class should have an instance of \Magento\Store\Model\StoreManagerInterface as a dependency that will give you the current store and id. private $storeManager; public function __construct( ... \Magento\Store\Model\StoreManagerInterface $storeManager, ... ) { ... $this->storeManager = $storeManager; .... } public function ...


Only top voted, non community-wiki answers of a minimum length are eligible