Use our Javascript API to send information about your products to PriceWaiter. When a user clicks our Name Your Price Button, they will make an offer on a screen showing this information. Set the product price, name, image and child options using these API calls.


Unsets a metadata option set using setMetadata or setMetadataValues

// Example setting metadata
PriceWaiter.setMetadata('referer', 'pinterest',);

// Unsets a metadata key


Remove all metadata values for this product or visitor set using setMetadata or setMetadataValues

// Example setting multiple metadata values
    affiliate_id: '1234AOUFA',
    referer: 'pinterest'

// Unsets all metadata values


Unsets a product option set using setProductOption


Unsets all product options set using setProductOption or setProductOptions.


Marks all product options as not required.


Returns true or false on whether the given option has been marked as required using setProductOptionRequired.

// Check if 'color' is a required option

setBrand(value) / getBrand()

Sets/gets the current product’s brand name.

// Set the logged in users email

setCategories(categories) / getCategories()

Gets/sets the category (or categories) this product is in. The categories array can contain two kinds of entries:

  • strings - A full category name
  • arrays - An array of string category segments indicating hierarchy.

For example: ["Electronics"] indicates the product is in one category: “Electronics”. ["Electronics", ["Electronics", "Cell Phones"]] indicates the product is in two categories: Electronics and Electronics > Cell Phones

Note that a product being a member of a hierarchical category does not mean it is automatically a member of all categories in the hierarchy. That is, membership in Electronics > Cell Phones does not imply membership in Electronics. If the product exists in both categories, they both must be specified in the categories array.

Categories can also be set via the product.categories configuration key.

// Product is in "Clothing > Shirts and Jackets" and "Fire Sale"
    ["Clothing", "Shirts and Jackets"],
    "Fire Sale"

// Product is in "Electronics" and "Electronics > Cell Phones" categories
    ["Electronics", "Cell Phones"]

setCountry(value) / getCountry()

Sets/gets the country code (ISO 3166-1 alpha-2). Equivalent to the country configuration key.


setCurrency(value) / getCurrency()

Sets/gets the currency to be used for the offer. Equivalent to currency configuration key. Must be a valid ISO-4217 currency code.

// Set currency to US Dollar

setEmail(value) / getEmail()

Sets/gets the current user’s email. Equivalent to the configuration key.

// Set the logged in users email

setMetadata(key, value) / getMetadata(key)

Sets/gets metadata. Tip: use a url-friendly key name, as this will be POSTed back to your Order Notification Callback URL.

// Example to pass along an affiliate code
PriceWaiter.setMetadata('affiliate_id', '1234AOUFA',);

setMetadataValues(obj) / getMetadataValues()

Sets/gets metadata. Tip: use url-friendly key names, as this will be POSTed back to your Order Notification Callback URL.

    affiliate_code, 'nike_air2',
    referer: 'pinterest'

setPostalCode(value) / getPostalCode()

Sets/gets the zip / postal code. Equivalent to the postal_code configuration key.


setPrice(value) / getPrice()

The current price for the product (as configured on the page). See setRegularPrice for non-sale price. Can be an decimal, integer or string.

Tip: This is price users will be comparing their offer to. Can be the sale price, otherwise use the product price.

// Example as a decimal

// Example as a formatted string

setRegularPrice(value) / getRegularPrice()

The non-sale price for the product. Can be an decimal, integer or string.

Tip: This option is typically used when setPrice is the sale price of a product.

// Example as a decimal

// Example as a formatted string

setProduct(value) / getProduct()

Sets/gets the name of the current product. Equivalent to configuration key.

PriceWaiter.setProduct('The Product Name');

setProductImage(value) / getProductImage()

Sets/gets the absolute URL of the product image. Equivalent to product.image configuration key.


setProductOption(name, value) / getProductOption(name)

Sets/gets an arbitrary option or variant for the current product.

// Set an item's size
PriceWaiter.setProductOption('size', 'Large');

// Set an item's color
PriceWaiter.setProductOption('color', 'Mayonnaise');

setProductOptionRequired(option, [required = true])

Mark one or more product options as “required”. If an option is required the PriceWaiter UI will not be shown unless a value has been provided for that option via setProductOption.

If the user clicks the Name Your Price button without configuring all required product options, the onProductOptionsRequired callback is fired, with an array of missing options passed as the first argument. If the callback has not been configured, the widget uses window.alert() to ask the user to provide all required options.

NOTE: A product option will fail the “requirement” test if:

  • Its value was never set or
  • Its value is equal to one of the following:
    • undefined
    • null
    • ’’ (empty string)
    • ’ ‘ (empty string with whitespace)

// Example setting a single option as required

// Example setting multiple options as required

Unsetting Required Options

To mark options as no longer required, you can use clearProductOption, clearProductOptions or pass false as the required argument _(see example)__

// Example make 'color' not required
PriceWaiter.setProductOptionRequired('color', false);

// Example make multiple options not required
], false);

setProductOptions(obj) / getProductOptions()

Sets/gets an object of the current products avialable options or variants.

// Setting multiple options or variants at once.
    size: 'Large',
    color: 'Mayonnaise'

setQuantity(int) / getQuantity()

Sets/gets the default quantity. Equivalent to quantity configuration key.

Tip: This method should be used whenever a user changes the quantity if you display a quantity option on your product detail page(s).

// Set currency to US Dollar

setSKU(value) / getSKU()

Sets/Gets the SKU or Manufacturer’s Part Number for the current product. Equivalent to the product.sku configuration key.

Tip: The SKU will be POSTed back to your Order Notification Callback URL as the primary product identifier.