Whisk Docs
Whisk HomeHelp CenterDeveloper Tools
v1.0.0
v1.0.0
  • Overview
  • Guides
    • Creating An Account
    • Getting Started
    • Whisk Sandbox
  • API
    • Authentication
      • Server Token
      • Client Token
      • User Access Token
      • Anonymous Access
    • Recipes
      • Get Recipe
      • Get Recipe Categories
      • Recipe Objects
    • Recipe Discovery
      • Recipe Feed
      • Recipe Search
      • Get Similar Recipes
    • Shopping Lists
      • Get Shopping Lists
      • Create A Shopping List
      • Add Items To A Shopping List
      • List Analysis
    • Meal Plans
      • Meal Plan Management
      • Delete Meals
      • Auto-Generator
      • Error Handling
    • Retailers
      • Get Available Stores
      • Retailers Checkout Flow
      • Retailer Aliases
      • OAuth Retailer Flow
      • Retailer User Info
      • Search Store Items
    • Carts
      • Create a Cart
      • Update Cart Item
      • Splitting Combined Items
      • Add Items To Cart
      • Add Recipes To Cart
      • Get Cart Item Options
      • Swap Cart Item Product
      • Delete A Cart Or A Cart Item
      • Checkout
    • Users
      • Get A User
      • Update A User
    • User Recipes & Collections
      • Add User Recipe
      • Create A Recipe
      • Update External Recipe
      • Get All User Recipes
      • Update User Recipe
      • Remove Recipe from Favorites
      • Create Collection
      • Get All User Collections
      • Get Collection
      • Get Recipes from a Collection
      • Remove Collection
    • Tools
      • Autocomplete
  • Shopping List SDK
    • Overview
    • Examples
      • Shoppable Recipes
      • Shoppable Products
      • Shoppable Media
    • Basic Setup
      • Basic Setup
      • Methods
      • Event Listeners
      • Widget
      • Subscriptions
      • Global Configuration
      • UTM Parameters
      • Using With SPA
  • Shopping List Mobile API
    • Overview
    • Examples
    • Reference
  • Tips and Tricks
    • Object IDs
    • URL Lookup
    • Searching
    • Multiple IDs request
  • Resources
    • Nutrients
    • Recipe Labels
    • Health Score, Glycemic Index, Glycemic Load
    • Whisk User Data
    • Supported Retailers
    • Optimizing Image Load
Powered by GitBook
On this page
  • Available Options
  • onlineCheckout object
  • styles object
  • button styles object
  • utm object

Was this helpful?

  1. Shopping List SDK
  2. Basic Setup

Global Configuration

PreviousSubscriptionsNextUTM Parameters

Last updated 5 years ago

Was this helpful?

Global configuration allows you to set parameters once to be used multiple times. For example, if you have two on a page and you want both of them to work with the same recipe URL. Without using global configuration you code will look like this:

whisk.queue.push(function() {
    whisk.listeners.addClickListener(
        'add-to-list',
        'shoppingList.addRecipeToList',
        {
            recipeUrl: 'https://whisk.com/demo/calzone-roasted-peppers'
        }
    );
    whisk.listeners.addClickListener(
        'add-to-basket',
        'shoppingList.addRecipeToBasket',
        {
            recipeUrl: 'https://whisk.com/demo/calzone-roasted-peppers'
        }
    );
});

We can simplify it by using global configuration:

whisk.queue.push(function() {
    whisk.config.set('shoppingList', {
        recipeUrl: 'https://whisk.com/demo/calzone-roasted-peppers'
    });
    whisk.listeners.addClickListener('add-to-list', 'shoppingList.addRecipeToList');
    whisk.listeners.addClickListener('add-to-basket', 'shoppingList.addRecipeToBasket');
});      

Alternatively, you can use dots to set a single option:

whisk.queue.push(function() {
  whisk.config.set('shoppingList.styles.size', 'large');
});

Available Options

ATTRIBUTE

TYPE

DESCRIPTION

global.language

string

Default language.

global.country

string

Default country.

global.whiteLabel

string

Default white label.

global.utm

utm

Object with tracking params.

global.trackingId

string

Unique identifier for your business (optional). This is a premium feature for our partners. Contact us to get one.

shoppingList.recipeUrl

string

Default recipe url for all widgets and click listeners. Default value: The URL of your current page

shoppingList.scale

number

All recipe ingredient quantities will be multiplied by this number

shoppingList.products

array [string]

Default product list for addProductsToList.

shoppingList.whiteLabel

string

Default white label for widgets.

shoppingList.hidden

string

Default value for hidden option. Read more about hidden widgets.

shoppingList.onlineCheckout

onlineCheckout

Object which configures shopping list app online checkout preferences.

shoppingList.styles

styles

Object which changes shopping list app appearance.

onlineCheckout object

ATTRIBUTE

TYPE

DESCRIPTION

enabled

boolean

Set it to false if you want to disable online checkout completely. Default value: true.

allowedRetailers

array [enum]

List of available retailers in the shopping list app. [] - is equal to enabled: false. Default value: all available retailers.

defaultRetailer

enum

Default retailer for the shopping list app. You can find list of available retailers here. Note: you can pass null to unset a default value for new users. Default value: is defined by Whisk API.

autoPick

string

Set it to true to go straight to checkout in addRecipeToBasket and addProductsToBasket methods

styles object

ATTRIBUTE

TYPE

DESCRIPTION

size

enum

Widget size. Possible values: compact, large. Default value: compact.

align

enum

Widget content alignment. Possible values: left, center, right. Default value: center.

button

buttonStyles

Style options for widget buttons.

linkColor

string

Link text colour.

button styles object

ATTRIBUTE

TYPE

DESCRIPTION

color

string

Button background colour.

textColor

string

Button text colour.

borderRadius

string

Button border radius.

text

string

Button text. Only valid for 'compact' size.

utm object

ATTRIBUTE

TYPE

DESCRIPTION

campaign

string

Identifies a specific product promotion or strategic campaign.

source

string

Identifies which site sent the traffic, and is a required parameter.

medium

string

Identifies what type of link was used, such as cost per click or email.

content

string

Identifies what specifically was clicked to bring the user to the site, such as a banner ad or a text link.

term

string

Identifies search terms.

click listeners