Product Hydration

There will be instances when products need to display differently from the data registered in Firework CMS. Product information can be updated from your OMS but not synced to Firework CMS. Product availability may also change based on real-time data. You can pass the latest information to the Firework player using Product Hydration.

Provide Product Data

With the Firework Shopping API onProductsLoaded, you can provide a list of products to be updated on the player interface. Consider the scenario above where the title and the product price are different in the e-commerce platform, and you want to display the most up-to-date information about the product on the player. You can use the following code snippet to achieve it:

Sample Code

// Helper method to convert a remote product to a Firework product object.
function createFWProduct(remoteProduct) {
  const { id, name, variations } = remoteProduct;
  return => {
    // 1. Update the product title.

    // 2. Update product variant price and availability.
    for (const remoteVariant of variations) {
      const { 
      } = remoteVariant;
      product.variant((variant) => {

// Configure callback to hydrate the product when the products are loaded. ({products}) => {
  const productIds = => product.produce_ext_id);
  // Make a server request to get the latest product data.
  const remoteProducts = await fetchProductsFromServer(productIds);
  return => createFWProduct(remoteProduct));

Last updated