Magento 2 graphQl fetch Store Configuration

The Magento 2 GraphQL call that returns store configuration values is an extremely useful tool for developers who need to access the configuration settings of a store. By utilizing this call, developers can easily retrieve information about the store’s base URL, currency code, product display options, and more.

The call returns a JSON object that contains all of the store configuration settings in an easily accessible format. Developers can access this data using a variety of methods, including parsing the JSON response directly or using third-party libraries to parse the response into an array or object.

{
  storeConfig {
    absolute_footer
    allow_guests_to_write_product_reviews
    allow_items
    allow_order
    autocomplete_on_storefront
    base_currency_code
    base_link_url
    base_media_url
    base_static_url
    base_url
    catalog_default_sort_by
    category_fixed_product_tax_display_setting
    category_url_suffix
    check_money_order_enable_for_specific_countries
    check_money_order_enabled
    check_money_order_make_check_payable_to
    check_money_order_max_order_total
    check_money_order_min_order_total
    check_money_order_new_order_status
    check_money_order_payment_from_specific_countries
    check_money_order_send_check_to
    check_money_order_sort_order
    check_money_order_title
    cms_home_page
    cms_no_cookies
    cms_no_route
    code
    configurable_thumbnail_source
    copyright
    default_description
    default_display_currency_code
    default_keywords
    default_title
    demonotice
    front
    grid_per_page
    grid_per_page_values
    head_includes
    head_shortcut_icon
    header_logo_src
    id
    is_default_store
    is_default_store_group
    list_mode
    list_per_page
    list_per_page_values
    locale
    logo_alt
    logo_height
    logo_width
    magento_wishlist_general_is_enabled
    minimum_password_length
    no_route
    payment_payflowpro_cc_vault_active
    product_fixed_product_tax_display_setting
    product_reviews_enabled
    product_url_suffix
    required_character_classes_number
    root_category_id
    root_category_uid
    sales_fixed_product_tax_display_setting
    secure_base_link_url
    secure_base_media_url
    secure_base_static_url
    secure_base_url
    send_friend {
      enabled_for_customers
      enabled_for_guests
    }
    show_cms_breadcrumbs
    store_code
    store_group_code
    store_group_name
    store_name
    store_sort_order
    timezone
    title_prefix
    title_separator
    title_suffix
    use_store_in_url
    website_code
    website_id
    website_name
    weight_unit
    welcome
    zero_subtotal_enable_for_specific_countries
    zero_subtotal_enabled
    zero_subtotal_new_order_status
    zero_subtotal_payment_action
    zero_subtotal_payment_from_specific_countries
    zero_subtotal_sort_order
    zero_subtotal_title
  }
}

One of the major benefits of using this GraphQL call is its flexibility. Because the call returns all of the configuration settings for a store, developers can easily retrieve specific pieces of information by parsing the JSON response. This means that developers can easily build custom tools and applications that leverage the store’s configuration settings in powerful ways.

For example, a developer might build a custom module that automatically updates a store’s currency exchange rates based on data from an external API. By using the store configuration values returned by the GraphQL call, the developer can easily access the store’s base currency code and exchange rate settings, and use this information to automatically update the exchange rates.

Overall, the Magento 2 GraphQL call that returns store configuration values is an incredibly powerful tool for developers working with Magento stores. Its flexibility, ease of use, and ability to provide access to all of the store’s configuration settings make it an essential tool for any developer looking to build custom applications and tools that leverage the power of Magento.

Example

{
  storeConfig {
    base_currency_code
    base_link_url
    base_media_url
    base_static_url
    base_url
  }
}

Response

{
  "data": {
    "storeConfig": {
      "base_currency_code": "GBP",
      "base_link_url": "https://my.site.com/",
      "base_media_url": "https://my.site.com/media/",
      "base_static_url": "https://my.site.com/static/version1681114408/",
      "base_url": "https://my.site.com/"
    }
  }
}

Leave a Comment

Your email address will not be published. Required fields are marked *