Menu Close
    Hire us Request quote Reading list Switch to dark mode

    List All Magento Stores in Magento2

     

    Magento manages multiple Websites, Stores as well as there store views. After installation by default one default Website, store and it’s store view created after that user can create multi Websites, Stores and there store views as per as requirement.

    This article demonstrate how to fetch list of all Magento stores in Magento 2.

     

    In earlier version(1.9.*) of Magento below codes helps to fetch list of all Magento stores,


     

    As there have several things are changed in Magento 2. So below code will help to fetch list of all stores in Magento 2.


    • _storeRepository: Is an object of “Magento\Store\Model\StoreRepository” class.
    • $store[“website_id”] : It will return website id.
    • $store[“store_id”] : It will return store id.
    • $store[“name”] : It will return store name.
    • $store[“group_id”] : It will return store group id.
    • $store[“code”] : It will return store code which is unique as per as store.
    • toOptionArray() : This  method will return list of stores.
    . . .

    Comment

    Add Your Comment

    Be the first to comment.

    Back to Top
    css.php
    Hire Us!
    Brief us about your requirements and we'll get back to you.
    Woo! Hooy!
    We have just received your message and our expert will get back to you shortly.
    Send Again
    Close