Retrieve Store data by code programmatically Magento 2.

You can retrieve the store details by store code using Magento 2.

You required only store code to fetch data of the store. If store code is not valid throws the error,

The store that was requested wasn’t found. Verify the store and try again2.

Useful Interface to get the store data:
Magento\Store\Api\StoreRepositoryInterface

You can get the store data by the foreach loop,

Output: Store Data.

Get Store Data Using the store code return the store related data.

Leave a Reply