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.

1 Answer 1

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; 
  • thanks for your answer. but i don't have access to admin or code. I have only website front name only.
    – Softec
    Jan 17, 2020 at 8:44
  • you don't need any admin access. Jan 17, 2020 at 8:47

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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