In this tutorial, Today I will explain how to get the store configuration value using GraphQL in Magento 2. To fetch the data from store configuration using a custom module and Query a store’s configuration
Here, explained all configuration data using storeConfig query. First of all, we will show you how to get details of the store’s configuration.
Query a store’s configuration
The following query returns all details of the store’s configuration:
Request:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 |
{ storeConfig { store_code locale base_currency_code default_display_currency_code timezone weight_unit base_url base_link_url base_static_url base_media_url secure_base_url secure_base_link_url secure_base_static_url secure_base_media_url store_name default_title default_keywords welcome send_friend{ enabled_for_guests enabled_for_customers } } } |
Response:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 |
{ "data": { "storeConfig": { "store_code": "default", "locale": "en_US", "base_currency_code": "USD", "default_display_currency_code": "USD", "timezone": "America/Chicago", "weight_unit": "lbs", "base_url": "https://shop.dev.webiators.com/", "base_link_url": "https://shop.dev.webiators.com/", "base_static_url": "https://shop.dev.webiators.com/static/version1649047605/", "base_media_url": "https://shop.dev.webiators.com/media/", "secure_base_url": "https://shop.dev.webiators.com/", "secure_base_link_url": "https://shop.dev.webiators.com/", "secure_base_static_url": "https://shop.dev.webiators.com/static/version1649047605/", "secure_base_media_url": "https://shop.dev.webiators.com/media/", "store_name": "Default Store View", "default_title": "Magento Commerce", "default_keywords": null, "welcome": "Default welcome msg!", "send_friend": { "enabled_for_guests": false, "enabled_for_customers": false } } } } |
Thank You!
Hit 5 Stars if you find this post helpful
0 (based on 0 Reviews)