Pricing & Availability

Item Prices and Availability

Pricing and availability for individual items and services are displayed in the Spectrum UI, with data provided by the spectrumItemPricesAndAvailabilityCallback function. This function has one argument in the signature: skus.

window.spectrumItemPricesAndAvailabilityCallback = function(itemsBySkuOrName) { 
  // itemsBySkuOrName: array of strings that can refer to SKUs, parts, or decoration services
}

This callback should return a promise that resolves to an array of objects with the following properties:

[
  {
    sku: 'exampleSku',
    name: 'Example',
    type: 'baseProduct',
    price: 99.99,
    listPrice: null,     // nullable list price to distinguish from sale price
    isoCurrency: 'USD',  // must be a valid ISO 4217 currency code
    inStock: true,
    options: null        // nullable options object with string values
  }
]

Total Price

Displaying the total price for a customized product at runtime can be supported by exposing a global spectrumTotalPriceCallback function. This ensures that ecommerce systems are the single source of truth pricing calculations and ensures that discounts, upcharges are accurate and consistent with how they appear at checkout.

window.spectrumTotalPriceCallback = function(items) {
  // items[n].sku: string | null
  // items[n].name: string | null
  // items[n].quantity: number (unsigned int)
}

This callback should return a promise that resolves into an object with the following properties:

{
  price: 999.99,
  isoCurrency: 'USD',  // must be a valid ISO 4217 currency code
  options: null        // nullable options object with string values
}

Last updated