In Magento 2 admin side, I added store switcher in phtml file using this code.
protected function _prepareLayout()
{
$this->getToolbar()->addChild(
'store_switcher',
'Magento\Backend\Block\Store\Switcher'
);
return parent::_prepareLayout();
}
So above code show store selection in phtml file as below,
When I select diffrent store from the list, then admin URL is change,
but when I access store information in phtml like this$this->_storeManager->getStore()->getCode()
but it always return "default" not selected store code.
Can Any one have idea ?
Best Answer