Magento 2 : Requested store is not found when store switching
-
08-01-2021 - |
Question
In magento 2.2, I have 2 store in my website. When, I switch to default store to other store. Then, it will display error like this
1 exception(s): Exception #0 (Magento\Framework\Exception\NoSuchEntityException): Requested store is not found
How can I solve this??
Please help me.
Solution
At line 164 add the below code of Magento\Store\Model\StoreManager
:
if(!$storeId){
if(isset($_COOKIE['store']) && $_COOKIE['store'] !== ''){
$storeId = $_COOKIE['store'];
} else {
$storeId = $this->getDefaultStoreView()->getCode();
}
}
And then, change 155 line of Magento\Store\Model\StoreManager
=> FROM :
if (null === $this->currentStoreId) {
=> To :
if (null === $this->currentStoreId || '' === $this->currentStoreId) {
OTHER TIPS
You can see the notes on https://github.com/magento/magento2/issues/11453. I ran into same issue for magento 2.2.
Licensed under: CC-BY-SA with attribution
Not affiliated with magento.stackexchange