runMode = $scopeCode ? $runMode : ScopeInterface::SCOPE_WEBSITE; $this->scopeCode = $scopeCode; $this->readerList = $readerList; $this->storeManager = $storeManager; } /** * Set current store for admin area * * @param \Magento\Framework\App\FrontController $subject * @param \Magento\Framework\App\RequestInterface $request * @return void * * @SuppressWarnings(PHPMD.UnusedFormalParameter) */ public function beforeDispatch( \Magento\Framework\App\FrontController $subject, \Magento\Framework\App\RequestInterface $request ) { $reader = $this->readerList->getReader($this->runMode); $defaultStoreId = $reader->getDefaultStoreId($this->scopeCode); $this->storeManager->setCurrentStore($defaultStoreId); } }