availableStores query
The availableStores
query returns configuration information about multiple store views. Use this query to implement a store switcher.
If the useCurrentGroup
input argument is set to true
, then the availableStores
query returns configuration information about store views that have the same parent store. If the input argument is not specified or is set to false
, the query returns values for all store views with the same parent website.
Specify the Store header to determine the scope of the call. Without this header, the query returns values for the default store view and other store views with the same parent store.
Syntax
availableStores(useCurrentGroup: Boolean): [StoreConfig]
Reference
The availableStores
reference provides detailed information about the types and fields defined in this query.
Example usage
The following query returns information about the store's basic catalog configuration.
Request:
Copied to your clipboardquery {availableStores(useCurrentGroup: true) {store_codestore_nameis_default_storestore_group_codeis_default_store_grouplocalebase_currency_codedefault_display_currency_codetimezoneweight_unitbase_urlbase_link_urlbase_static_urlbase_media_urlsecure_base_urlsecure_base_link_urlsecure_base_static_urlsecure_base_media_url}}
Response:
Copied to your clipboard{"data": {"availableStores": [{"store_code": "default","store_name": "Default Store View","is_default_store": true,"store_group_code": "main_website_store","is_default_store_group": true,"locale": "en_US","base_currency_code": "USD","default_display_currency_code": "USD","timezone": "America/Chicago","weight_unit": "lbs","base_url": "http://example.com/","base_link_url": "http://example.com/","base_static_url": "http://example.com/pub/static/version1606976517/","base_media_url": "http://example.com/pub/media/","secure_base_url": "http://example.com/","secure_base_link_url": "http://example.com/","secure_base_static_url": "http://example.com/pub/static/version1606976517/","secure_base_media_url": "http://example.com/pub/media/"},{"store_code": "de","store_name": "Europe Store View","is_default_store": false,"store_group_code": "main_website_store","is_default_store_group": true,"locale": "de_DE","base_currency_code": "USD","default_display_currency_code": "EUR","timezone": "Europe/Berlin","weight_unit": "lbs","base_url": "http://example.com/","base_link_url": "http://example.com/","base_static_url": "http://example.com/pub/static/version1606976517/","base_media_url": "http://example.com/pub/media/","secure_base_url": "http://example.com/","secure_base_link_url": "http://example.com/","secure_base_static_url": "http://example.com/pub/static/version1606976517/","secure_base_media_url": "http://example.com/pub/media/"}]}}