Added to Wishlist Event

Event triggered when adding a product to wishlist.

sw:addedtowishlist

Can be triggered when a product is added to the user’s wishlist.

Definition

swat.evtLayer.addEventListener('sw:addedtowishlist', listener)

Example

By adding this event listener, sw:addedtowishlist event gets fired from the Swym Default UI on adding a product to the Wishlist.

// Define the event
let event = 'sw:addedtowishlist';

// Define the event listener function
let listener = function(e) {
	var data = e.detail.d;
	console.log("YAY! Added the product to wishlist", data);
};

// Add listener for the 'addedtowishlist' event to the Swym Event Layer
swat.evtLayer.addEventListener(event, listener);

Event Response

The success response consists of a console.log message with the text _'YAY! Added the product to wishlist'.

JSON that contains details of the product added to Wishlist.

{
  "bt": "Swym Marketing",
  "cts": 1679570510837,
  "di": "c3feba7e-c0e0-47cb-be5e-5c32e688fa84",
  "dt": "Ceramic Oval Basin",
  "du": "https://demo.swym.it/products/ceramic-oval-basin",
  "empi": 7096231231686,
  "epi": 41254655393990,
  "iu": "https://cdn.shopify.com/s/files/1/0534/3635/0662/products/ceramicovalbasin_620x620.jpg?v=1637582881",
  "lid": "9f63f7b3-2db4-42ae-bf8b-d728484cad60",
  "pid": "KABSbuGyYCuM6/IV7e7cGxT1978LieU1jRdMt6XhYfo=",
  "pr": 300,
  "sku": "23",
  "uts": 1679570510837,
  "_pkey": "c3feba7e",
  "_t": 2
}