Showing results for 
Search instead for 
Did you mean: 

Getting Store Name


Getting Store Name

We have a block that calls a phtml file that reads an external json stream to fill in some data on the fly.  I want to add in a switch-case that reads the store name so I can change some variables around for my stream. I know in magento1 i could do it easily with 


how do I do this in Magento2? 


Re: Getting Store Name

Get current a store programmatically:

Re: Getting Store Name

Edited your reply slightly:


$om = \Magento\Framework\App\ObjectManager::getInstance();
$manager = $om->get('Magento\Store\Model\StoreManagerInterface');
$store = $manager->getStore(null)->getName();


Still marking as solution, thank you.