cancel
Showing results for 
Search instead for 
Did you mean: 

Getting Store Name

SOLVED

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 

Mage::app()->getStore()->getName();

how do I do this in Magento2? 

1 ACCEPTED SOLUTION

Accepted Solutions

Re: Getting Store Name

Get current a store programmatically: https://mage2.pro/t/55

View solution in original post

2 REPLIES 2

Re: Getting Store Name

Get current a store programmatically: https://mage2.pro/t/55

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.