To enable customised adding to cart Unali tag exposes an add to cart callback that can be used to build a custom integration where necessary.

For further support reach out to [email protected]

Usage

To register the callback:

Unali.onAddToCart((products) => {
  // this function will be called when 
  // add to cart is clicked in the widget

  // `products` is an array. Example usage:

  products.forEach((product) => {
    // `product` is an Object with following properties:
    console.log(product.externalProductId);   // the product id provided by the brand at import
    console.log(product.externalVariantId);   // variant id provided by the brand at import
    console.log(product.price);               // products price
    console.log(product.quantity);            // quantity of items added to cart
    console.log(product.name);                // product's name
    console.log(product.reference);           // attribution reference hash to track back to the wish list
  });
});