|
| 1 | +--- |
| 2 | +group: graphql |
| 3 | +title: storeConfig query |
| 4 | +--- |
| 5 | + |
| 6 | +The `storeConfig` query defines information about a store's configuration. You can query a non-default store by [changing the header]({{ page.baseurl }}/graphql/send-request.html) in your GraphQL request. |
| 7 | + |
| 8 | +## Syntax |
| 9 | + |
| 10 | +`storeConfig: StoreConfig` |
| 11 | + |
| 12 | +## Example usage |
| 13 | + |
| 14 | +### Query a store's configuration |
| 15 | + |
| 16 | +The following call returns all details of a store's configuration. |
| 17 | + |
| 18 | +**Request:** |
| 19 | + |
| 20 | +```graphql |
| 21 | +{ |
| 22 | + storeConfig { |
| 23 | + id |
| 24 | + code |
| 25 | + website_id |
| 26 | + locale |
| 27 | + base_currency_code |
| 28 | + default_display_currency_code |
| 29 | + timezone |
| 30 | + weight_unit |
| 31 | + base_url |
| 32 | + base_link_url |
| 33 | + base_static_url |
| 34 | + base_media_url |
| 35 | + secure_base_url |
| 36 | + secure_base_link_url |
| 37 | + secure_base_static_url |
| 38 | + secure_base_media_url |
| 39 | + store_name |
| 40 | + send_friend { |
| 41 | + enabled_for_customers |
| 42 | + enabled_for_guests |
| 43 | + } |
| 44 | + } |
| 45 | +} |
| 46 | +``` |
| 47 | + |
| 48 | +**Response:** |
| 49 | + |
| 50 | +```json |
| 51 | +{ |
| 52 | + "data": { |
| 53 | + "storeConfig": { |
| 54 | + "id": 1, |
| 55 | + "code": "default", |
| 56 | + "website_id": 1, |
| 57 | + "locale": "en_US", |
| 58 | + "base_currency_code": "USD", |
| 59 | + "default_display_currency_code": "USD", |
| 60 | + "timezone": "America/Chicago", |
| 61 | + "weight_unit": "lbs", |
| 62 | + "base_url": "http://magento2.vagrant193/", |
| 63 | + "base_link_url": "http://magento2.vagrant193/", |
| 64 | + "base_static_url": "http://magento2.vagrant193/pub/static/version1536249714/", |
| 65 | + "base_media_url": "http://magento2.vagrant193/pub/media/", |
| 66 | + "secure_base_url": "http://magento2.vagrant193/", |
| 67 | + "secure_base_link_url": "http://magento2.vagrant193/", |
| 68 | + "secure_base_static_url": "http://magento2.vagrant193/pub/static/version1536249714/", |
| 69 | + "secure_base_media_url": "http://magento2.vagrant193/pub/media/", |
| 70 | + "store_name": "My Store", |
| 71 | + "send_friend": { |
| 72 | + "enabled_for_customers": true, |
| 73 | + "enabled_for_guests": false |
| 74 | + } |
| 75 | + } |
| 76 | + } |
| 77 | +} |
| 78 | +``` |
| 79 | + |
| 80 | +### Query a store's theme |
| 81 | + |
| 82 | +The following query returns information about the store's default title, keywords, and welcome text. |
| 83 | + |
| 84 | +**Request:** |
| 85 | + |
| 86 | +```graphql |
| 87 | +{ |
| 88 | + storeConfig { |
| 89 | + default_title |
| 90 | + default_keywords |
| 91 | + welcome |
| 92 | + } |
| 93 | +} |
| 94 | +``` |
| 95 | + |
| 96 | +**Response:** |
| 97 | + |
| 98 | +```json |
| 99 | +{ |
| 100 | + "data": { |
| 101 | + "storeConfig": { |
| 102 | + "default_title": "Magento Enterprise Edition", |
| 103 | + "default_keywords": "Magento, Varien, E-commerce", |
| 104 | + "welcome": "Default welcome msg!" |
| 105 | + } |
| 106 | + } |
| 107 | +} |
| 108 | +``` |
| 109 | + |
| 110 | +### Query a store's CMS configuration |
| 111 | + |
| 112 | +The following query returns information about the store's content pages. |
| 113 | + |
| 114 | +**Request:** |
| 115 | + |
| 116 | +```graphql |
| 117 | +{ |
| 118 | + storeConfig { |
| 119 | + front |
| 120 | + cms_home_page |
| 121 | + no_route |
| 122 | + cms_no_route |
| 123 | + cms_no_cookies |
| 124 | + show_cms_breadcrumbs |
| 125 | + } |
| 126 | +} |
| 127 | +``` |
| 128 | + |
| 129 | +**Response:** |
| 130 | + |
| 131 | +```json |
| 132 | +{ |
| 133 | + "data": { |
| 134 | + "storeConfig": { |
| 135 | + "front": "cms", |
| 136 | + "cms_home_page": "home", |
| 137 | + "no_route": "cms/noroute/index", |
| 138 | + "cms_no_route": "no-route", |
| 139 | + "cms_no_cookies": "enable-cookies", |
| 140 | + "show_cms_breadcrumbs": 1 |
| 141 | + } |
| 142 | + } |
| 143 | +} |
| 144 | +``` |
| 145 | + |
| 146 | +### Query a store's Catalog configuration |
| 147 | + |
| 148 | +The following query returns information about the store's catalog configuration. |
| 149 | + |
| 150 | +**Request:** |
| 151 | + |
| 152 | +```graphql |
| 153 | +{ |
| 154 | + storeConfig { |
| 155 | + product_url_suffix |
| 156 | + category_url_suffix |
| 157 | + title_separator |
| 158 | + list_mode |
| 159 | + grid_per_page_values |
| 160 | + list_per_page_values |
| 161 | + grid_per_page |
| 162 | + list_per_page |
| 163 | + catalog_default_sort_by |
| 164 | + } |
| 165 | +} |
| 166 | +``` |
| 167 | + |
| 168 | +**Response:** |
| 169 | + |
| 170 | +```json |
| 171 | +{ |
| 172 | + "data": { |
| 173 | + "storeConfig": { |
| 174 | + "product_url_suffix": ".html", |
| 175 | + "category_url_suffix": ".html", |
| 176 | + "title_separator": "-", |
| 177 | + "list_mode": "grid-list", |
| 178 | + "grid_per_page_values": "9,15,30", |
| 179 | + "list_per_page_values": "5,10,15,20,25", |
| 180 | + "grid_per_page": 9, |
| 181 | + "list_per_page": 10, |
| 182 | + "catalog_default_sort_by": "position" |
| 183 | + } |
| 184 | + } |
| 185 | +} |
| 186 | +``` |
| 187 | + |
| 188 | +### Query a store's fixed product tax configuration |
| 189 | + |
| 190 | +The following query returns enumeration values that indicate the store's fixed product tax configuration. |
| 191 | + |
| 192 | +**Request:** |
| 193 | + |
| 194 | +```graphql |
| 195 | +{ |
| 196 | + storeConfig { |
| 197 | + category_fixed_product_tax_display_setting |
| 198 | + product_fixed_product_tax_display_setting |
| 199 | + sales_fixed_product_tax_display_setting |
| 200 | + } |
| 201 | +} |
| 202 | +``` |
| 203 | + |
| 204 | +**Response:** |
| 205 | + |
| 206 | +```json |
| 207 | +{ |
| 208 | + "data": { |
| 209 | + "storeConfig": { |
| 210 | + "category_fixed_product_tax_display_setting": "EXCLUDE_FPT_WITHOUT_DETAILS", |
| 211 | + "product_fixed_product_tax_display_setting": "EXCLUDE_FPT_AND_INCLUDE_WITH_DETAILS", |
| 212 | + "sales_fixed_product_tax_display_setting": "INCLUDE_FPT_WITHOUT_DETAILS" |
| 213 | + } |
| 214 | + } |
| 215 | +} |
| 216 | +``` |
| 217 | + |
| 218 | +## Output attributes |
| 219 | + |
| 220 | +### Supported storeConfig attributes |
| 221 | + |
| 222 | +Use the `storeConfig` attributes to retrieve information about the store's configuration; such as, locale, currency codes, and secure and unsecure URLs. |
| 223 | + |
| 224 | +Attribute | Data Type | Description | Example |
| 225 | +--- | --- | --- | --- |
| 226 | +`base_currency_code` | String | The code representing the currency in which Magento processes all payment transactions | `USD` |
| 227 | +`base_link_url` | String | A fully-qualified URL that is used to create relative links to the `base_url` | `http://magentohost.example.com/` |
| 228 | +`base_static_url` | String | The fully-qualified URL that specifies the location of static view files | `http://magentohost.example.com/pub/static/` |
| 229 | +`base_media_url` | String | The fully-qualified URL that specifies the location of user media files | `http://magentohost.example.com/pub/media/` |
| 230 | +`base_url` | String | The store's fully-qualified base URL | `http://magentohost.example.com/` |
| 231 | +`code` | String | A unique identifier for the store | `default` |
| 232 | +`default_display_currency_code` | String | The code representing the currency displayed on the store | `USD` |
| 233 | +`id` | Integer | The ID number assigned to the store | `1` |
| 234 | +`locale` | String | The store's locale | `en_US` |
| 235 | +`secure_base_link_url` | String | A secure fully-qualified URL that is used to create relative links to the `base_url` | `https://magentohost.example.com/` |
| 236 | +`secure_base_media_url` | String | The secure fully-qualified URL that specifies the location of user media files | `https://magentohost.example.com/pub/media/` |
| 237 | +`secure_base_static_url` | String | The secure fully-qualified URL that specifies the location of static view files | `https://magentohost.example.com/pub/static/` |
| 238 | +`secure_base_url` | String | The store's fully-qualified secure base URL | `https://magentohost.example.com/` |
| 239 | +`send_friend` | SendFriendConfiguration | Email to a Friend configuration | Not applicable |
| 240 | +`store_name` | String | The store's name | `My Store` |
| 241 | +`timezone` | String | The store's time zone | `America/Chicago` |
| 242 | +`website_id` | Integer | The ID number assigned to the parent website | `1` |
| 243 | +`weight_unit` | String | The weight unit for products | `lbs`, `kgs`, or similar |
| 244 | + |
| 245 | +#### SendFriendConfiguration attributes |
| 246 | + |
| 247 | +Attribute | Data Type | Description |
| 248 | +--- | --- | --- |
| 249 | +`enabled_for_customers` | Boolean! | Indicates whether the Email to a Friend feature is enabled for customers |
| 250 | +`enabled_for_guests` | Boolean! | Indicates whether the Email to a Friend feature is enabled for guests |
| 251 | + |
| 252 | +### Supported theme attributes |
| 253 | + |
| 254 | +Use the `theme` attributes to retrieve information about the store's thematic elements; such as, footer and header information, copyright text, and logo information. These attributes are defined in the `ThemeGraphQl` module. |
| 255 | + |
| 256 | +Attribute | Data Type | Description |
| 257 | +--- | --- | --- |
| 258 | +`absolute_footer` | String | Contains scripts that must be included in the HTML before the closing `<body>` tag |
| 259 | +`copyright` | String | The copyright statement that appears at the bottom of each page |
| 260 | +`default_description` | String | The description that provides a summary of your site for search engine listings and should not be more than 160 characters in length |
| 261 | +`default_keywords` | String | A series of keywords that describe your store, each separated by a comma |
| 262 | +`default_title` | String | The title that appears at the title bar of each page when viewed in a browser |
| 263 | +`demonotice` | Int | Controls the display of the demo store notice at the top of the page. Options: `0` (No) or `1` (Yes) |
| 264 | +`head_includes` | String | Contains scripts that must be included in the HTML before the closing `<head>` tag |
| 265 | +`head_shortcut_icon` | String | Uploads the small graphic image that appears in the address bar and tab of the browser |
| 266 | +`header_logo_src` | String | The path to the logo that appears in the header |
| 267 | +`logo_alt` | String | The Alt text that is associated with the logo |
| 268 | +`logo_height` | Int | The height of your logo image in pixels |
| 269 | +`logo_width` | Int | The width of your logo image in pixels |
| 270 | +`title_prefix` | String | A prefix that appears before the title to create a two- or three-part title |
| 271 | +`title_suffix` | String | A suffix that appears after the title to create a two-or three part title |
| 272 | +`welcome` | String | Text that appears in the header of the page and includes the name of customers who are logged in |
| 273 | + |
| 274 | +### Supported CMS attributes |
| 275 | + |
| 276 | +Use the `cms` attributes to retrieve information about the store's default pages. These attributes are defined in the `CmsGraphQl` module. |
| 277 | + |
| 278 | +Attribute | Data Type | Description |
| 279 | +--- | --- | --- |
| 280 | +`cms_home_page` | String | Returns the name of the CMS page that identifies the home page for the store |
| 281 | +`cms_no_cookies` | String | Identifies a specific CMS page that appears when cookies are not enabled for the browser |
| 282 | +`cms_no_route` | String | Identifies a specific CMS page that you want to appear when a 404 “Page Not Found” error occurs |
| 283 | +`front` | String | Indicates the landing page that is associated with the base URL |
| 284 | +`no_route` | String | Contains the URL of the default page that you want to appear when if a 404 “Page not Found” error occurs |
| 285 | +`show_cms_breadcrumbs` | Int | Determines if a breadcrumb trail appears on all CMS pages in the catalog. Options: `0` (No) or `1` (Yes) |
| 286 | + |
| 287 | +### Supported Catalog attributes |
| 288 | + |
| 289 | +Use the `catalog` attributes to retrieve information about the store's catalog. These attributes are defined in the `CatalogGraphQl` module. |
| 290 | + |
| 291 | +Attribute | Data Type | Description | Example |
| 292 | +--- | --- | --- |
| 293 | +`catalog_default_sort_by` | String | The default sort order of the search results list | `position` |
| 294 | +`category_url_suffix` | String | The suffix applied to category pages, such as `.htm` or `.html` | `.html` |
| 295 | +`grid_per_page` | Int | The default number of products per page in Grid View | `9` |
| 296 | +`grid_per_page_values` | A list of numbers that define how many products can be displayed in List View | `9,15,30` |
| 297 | +`list_mode` | String | The format of the search results list | `grid-list` |
| 298 | +`list_per_page` | Int | The default number of products per page in List View | `10` |
| 299 | +`list_per_page_values` | String | A list of numbers that define how many products can be displayed in List View | `5,10,15,20,25` |
| 300 | +`product_url_suffix` | String | The suffix applied to product pages, such as `.htm` or `.html` | `.html` |
| 301 | +`root_category_id` | Int | The ID of the root category |
| 302 | +`title_separator` | String | Identifies the character that separates the category name and subcategory in the browser title bar | `-` |
| 303 | + |
| 304 | +### Supported WEEE (fixed product tax) attributes |
| 305 | + |
| 306 | +The **Stores** > Settings > **Configuration** > **Sales** > **Tax** > **Fixed Product Taxes** panel contains several fields that determine how to display fixed product tax (FPT) values and descriptions. Use the following attributes to determine the values of the **Fixed Product Taxes** fields. These attributes are defined in the `WeeeGraphQl` module. |
| 307 | + |
| 308 | +Attribute | Data Type | Description |
| 309 | +--- | --- | --- |
| 310 | +`category_fixed_product_tax_display_setting` | FixedProductTaxDisplaySettings | Corresponds to the **Display Prices In Product Lists** field. It indicates how FPT information is displayed on category pages |
| 311 | +`product_fixed_product_tax_display_setting` | FixedProductTaxDisplaySettings | Corresponds to the **Display Prices On Product View Page** field. It indicates how FPT information is displayed on product pages |
| 312 | +`sales_fixed_product_tax_display_setting` | FixedProductTaxDisplaySettings | Corresponds to the **Display Prices In Sales Modules** field. It indicates how FPT information is displayed on cart, checkout, and order pages |
| 313 | + |
| 314 | +The `FixedProductTaxDisplaySettings` data type is an enumeration that describes whether displayed prices include fixed product taxes and whether Magento separately displays detailed information about the FPTs. |
| 315 | + |
| 316 | +Value | Description |
| 317 | +--- | --- |
| 318 | +EXCLUDE_FPT_AND_INCLUDE_WITH_DETAILS | The displayed price does not include the FPT amount. You must display the values of `ProductPrice.fixed_product_taxes` and the price including the FPT separately. This value corresponds to **Excluding FPT, Including FPT description and final price** |
| 319 | +EXCLUDE_FPT_WITHOUT_DETAILS | The displayed price does not include the FPT amount. The values from `ProductPrice.fixed_product_taxes` are not displayed. This value corresponds to **Excluding FPT** |
| 320 | +FPT_DISABLED | The FPT feature is not enabled. You can omit `ProductPrice.fixed_product_taxes` from your query |
| 321 | +INCLUDE_FPT_WITH_DETAILS | The displayed price includes the FPT amount while displaying the values of `ProductPrice.fixed_product_taxes` separately. This value corresponds to **Including FPT and FPT description** |
| 322 | +INCLUDE_FPT_WITHOUT_DETAILS | The displayed price includes the FPT amount without displaying the `ProductPrice.fixed_product_taxes` values. This value corresponds to **Including FPT only** |
| 323 | + |
| 324 | +## Extend configuration data |
| 325 | + |
| 326 | +You can add your own configuration to the `storeConfig` query within your own module. |
| 327 | + |
| 328 | +To do this, configure the constructor argument `extendedConfigData` in the `argument` node in your area-specific `etc/graphql/di.xml` file. |
| 329 | + |
| 330 | +The following example adds an array-item to the `extendedConfigData` array within the construct of the `StoreConfigDataProvider`. |
| 331 | + |
| 332 | +```xml |
| 333 | +<?xml version="1.0" ?> |
| 334 | +<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:ObjectManager/etc/config.xsd"> |
| 335 | + <type name="Magento\StoreGraphQl\Model\Resolver\Store\StoreConfigDataProvider"> |
| 336 | + <arguments xsi:type="array"> |
| 337 | + <argument name="extendedConfigData"> |
| 338 | + <item name="section_group_field" xsi:type="string">section/group/field</item> |
| 339 | + </argument> |
| 340 | + </arguments> |
| 341 | + </type> |
| 342 | +</config> |
| 343 | +``` |
| 344 | + |
| 345 | +You must also extend the type `storeConfig` within in the `etc/schema.graphqls` file, as shown below: |
| 346 | + |
| 347 | +```graphql |
| 348 | +type StoreConfig { |
| 349 | + section_group_field : String @doc(description: "Extended Config Data - section/group/field") |
| 350 | +} |
| 351 | +``` |
0 commit comments