0

I want to get store name and store URL in magento 2.

https://www.mageplaza.com/devdocs/how-get-store-information-magento-2.html

I tried to use Magento\Store\Model\StoreManagerInterface and get the store with this code

$this->storeManager->getStore()->getName()

However, this always returns the string Default Store View instead of my store name

I tried $this->storeManager->getStore()->getCurrentUrl(true) to get the store URL but there is no getCurrentUrl in the StoreInterface;

4

1 Answer 1

0

Can you check this and tell me if it works or not

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

Thanks in advance,

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.