Magento 2 – How to get Current Store ID, Code, Name, URL and Website ID

In this post I am going to explain how to get current store information like store id, code, name, url and website id in Magento 2.

1. Using Dependency Injection

 

Add below code snippet in template file.

 

2. Using Object Manager

Thats it. Enjoy Magento 2!!

2 Comments

  1. Very valuable post and very well explained. Thanks for sharing!

  2. The object manager method is exactly what i was looking for to get the store name in my payment method controller
    Thanks!

Leave a Reply

Your email address will not be published. Required fields are marked *