How To Get Current Magento 2 Store Info Programmatically

How can I get current Magento 2 store info from Block class programmatically. Like store name, store id, store code, store url, is store active, website id and store name
To get current Magento 2 store’s info programmatically, you need load “Magento\Store\Model\StoreManagerInterface” object first and then call “getStore()” method to retrive current store object. Here is the example.

objectManager = \Magento\Framework\App\ObjectManager::getInstance();
$storeManager = $objectManager->get(‘\Magento\Store\Model\StoreManagerInterface’);

Get current store’s  id


Get current store’s code


Get current website ID


Get current store’s name


Get current store’s url


Check current store is active or inactive


0 0 vote
Article Rating
Notify of
Inline Feedbacks
View all comments