Skip to main content

Product methods

Products are often a key component of Experiences, whether recommending items, displaying product information, or personalizing content based on product data. Using the Experience JS SDK, you can retrieve detailed product information including pricing, availability, images, and custom attributes. The methods below enable you to access and work with product data in your Experience.

getProduct

Arguments

ArgumentTypeDescription
productIdstring - requiredProduct ID or SKU

This method returns the product details for the given Product ID or SKU.

Example

async function fetchProduct() {
const product = await window.wyng['_WYNG_ID_'].getProduct('SKU96405');
console.log(product);
}

fetchProduct();

Potential Output

{
"availability": "in stock",
"click_through_url": "https://www.bobbibrowncosmetics.com/product/14017/29723/makeup/face/foundation/skin-foundation-stick/ss14/Skin-Foundation-Stick#/shade/Neutral_Porcelain_%28N-",
"color": "Neutral Porcelain (N-010)",
"custom1": "Extra light beige with a balance of yellow & pink; slightly more yellow; for pale skin",
"custom2": "All skin tones and types.",
"custom3": "After moisturizing skin, lightly glide across forehead, cheeks, nose, and chin. Blend with fingertips or a sponge. Build coverage as desired.",
"description": "A portable cream foundation stick that glides on weightless medium-to-full coverage that lasts all day.",
"external_id": "SKU100605",
"image_url": "https://www.bobbibrowncosmetics.com/media/export/cms/products/v2_1080x1080/bb_sku_EA6C37_1080x1080_0.jpg",
"item_group_id": "29723",
"name": "Skin Foundation Stick, Neutral Porcelain",
"price": "$69.00",
"sale_price": "$59.00",
"size": "0.31 oz/9g"
}