0

I would like to find out the different ways how one can identify store views if website having multi store codes.

PS. I'm using store switcher at the moment but is there any other way Magento exposing the store codes on the front end.

0
public function __construct( ..., \Magento\Store\Model\StoreManagerInterface $storeManager ) 
{ 
      
    $this->_storeManager = $storeManager; 
}


private function getStoreData()
{          $storeManagerDataList =  $this->_storeManager->getStores();      
    $options = array();           
    foreach ($storeManagerDataList as $key => $value) 
    {                
        $options[] = ['label' => $value['name'].' - '.$value['code'], 'value' => $key];      
    }      
    return $options; 
}
| improve this answer | |
  • thanks for your answer. but i don't have access to admin or code. I have only website front name only. – MageSoftech Jan 17 at 8:44
  • you don't need any admin access. – Naresh Rupareliya Jan 17 at 8:47

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.