Filter
What would you like to search for?
Frontend API
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.
{
"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...
}
Methods to retrieve settings may return a promise if all settings haven't been loaded yet.
Returns the entire store settings object.
await swell.settings.get()
Returns a value from the store settings object using path notation, with an optional default if the value is undefined.
await swell.settings.get('colors.primary.dark', '#000000')
Returns an object representing store settings, and saves it to an internal cache for accessing synchronously.
We recommend calling load() when initially loading a storefront so that all other calls to get() will be synchronous.
await swell.settings.load()
Returns an array containing store navigation menus, and saves it to an internal cache for accessing synchronously.
await swell.settings.menus()
Returns a single navigation menu object.
await swell.settings.menus('header')
Returns an object representing payment settings and saves it to an internal cache for use with checkout methods.
await swell.settings.payments()