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.
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()
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
await swell.cart.getSettings()