# Settings

Source: https://developers.swell.is/frontend-api/settings

**Swell.js:**

Use settings to make storefront apps responsive to admin preferences such as store name, locale, currency, etc. In addition to `store` properties described below, app-specific settings are included in the result set.

### Get all settings

Methods to retrieve settings may return a promise if all settings haven't been loaded yet.

Returns the entire store settings object.

**Get all settings**

**swell.js** `Query`

```javascript
await swell.settings.get()
```

**swell.js** `Example response`

```json
{
  "store": {
    "id": "example",
    "name": "Example Store",
    "url": "https://example.swell.store",
    "country": "US",
    "locale": "en-US",
    "support_email": "support@example.com",
    "support_phone": "(555) 555-5555",
    "currency": "USD",
    "public_key": "pk_cn6XsV3m28OjPuN68JdqYbbWJSUGbCqX",
    "currencies": [
      {
        "code": "USD",
        "rate": 1,
        "name": "US Dollar",
        "symbol": "$",
        "decimals": 2,
        "type": "base"
      },
      {
        "code": "EUR",
        "rate": 0.82542,
        "name": "Euro",
        "symbol": "€",
        "decimals": 3,
        "type": "display"
      }
    ],
    "analytics_scripts": "...",
    "facebook_pixel_id": "..."
  },

  // app-specific settings...
}
```

### Getting setting by path

Returns a value from the store settings object using path notation, with an optional default if the value is undefined.

**Get settings by path**

**swell.js**

```- Select a language -
await swell.settings.get('colors.primary.dark', '#000000')
```

### Load all settings

Loads all store settings in a single request and caches them, along with navigation menus, payment settings, and subscription settings, so that later calls such as get(), menus(id), payments(), and subscriptions() return synchronously. This method does not return the settings object — call get() after it resolves. If the request fails, load() logs the error and resolves anyway rather than rejecting.

We recommend calling `load()` when initially loading a storefront so that all other calls to `get()` will be synchronous.

**Load all settings**

**swell.js**

```javascript
await swell.settings.load()
```

### Get checkout settings

Use to retrieve settings that can affect checkout behavior.

Returns object with:

- `name` - Store name
- `currency` - Store base currency
- `support_email` - Email address for customer support
- `fields` - Set of checkout fields to show as optional or required
- `scripts` - Custom scripts including script tags
- `accounts` - Indicates whether account login is `optional`, `disabled`, or `required`
- `email_optin` - Indicates whether email newsletter opt-in should be presented as optional
- `terms_policy` - Store terms and conditions
- `refund_policy` - Store refund policy
- `privacy_policy` - Store privacy policy
- `theme` - Checkout style settings
- `countries` - List of two letter ISO country codes that have shipping zones configured
- `currencies` - List of currencies enabled by the store when using multi-currency
- `payment_methods` - List of active payment methods
- `coupons` - Indicates whether the store has coupons
- `giftcards` - Indicates whether the store has gift cards

**Get checkout settings**

**swell.js**

```javascript
await swell.cart.getSettings()
```

**GraphQL:**

Use settings to make storefront apps responsive to admin preferences such as store name, locale, currency, etc. In addition to `store` properties described below, app-specific settings are included in the result set.

### Get all settings

Returns the store settings object, as well as specific settings like store URL.

The parameters for this query are `_locale` and `_currency`.

**Get all settings**

**GraphQL** `Get all settings`

```graphql
query getStoreSettings {
  storeSettings {
    store {
      name
      homePage
      currency
      currencies {
        code
        name
        rate
        symbol
        decimals
        priced
        type
      }
      locale
      locales {
        name
        code
        fallback
      }
    }
    values
  }
}
```

**GraphQL** `Get store URLS only`

```graphql
query getStoreUrl {
  storeSettings {
    store {
      url
    }
  }
}
```

### Get subscription settings

Use to retrieve settings that can affect subscription behavior. Returns the subscription settings object.

The parameters for this query are `_locale` and `_currency`.

**Get subscription settings**

**GraphQL**

```graphql
query {
  subscriptionSettings {
    features
    pauseNextSkipThreshold
  }
}
```
