Magento 2 supports building multiple stores and managing them using a single admin panel. If you are a developer working on a custom module, sometimes you may require to get all stores’ list by website ID in Magento 2 to implement store-wise functionalities.
Suppose you have created different stores for different countries in Magento 2 and want to show country-wise currencies. For example: You want to set the $USD as default currency for the US store and £ for the UK store. In such case, you may require to get all store’s list by website ID in Magento 2.
The solution is to use the getStoresList function in the root Data.php file to get the list of all stores by website ID.
You can read the complete solution at https://meetanshi.com/blog/get-all-stores-list-by-website-id-in-magento-2/
No comments:
Write comments