Delete From List

Delete a product from a list.

swat.deleteFromList

Deletes a Product from a List with the given lid.

Definition

swat.deleteFromList(lid, product, onSuccess, onError)

Example

Here's an example of how you can use this API to delete a Product from a List called black friday list:

// Define the list id of the list to be updated
let lid = "59179e9f-139d-4857-bcdd-3ad88a38b47d"; // lid

// Define the Product to be deleted
let product = {
  epi: epi,  // unique variant id  per listid
  empi: empi, // product id
  du: du // product url.
};

// Define success callback 
let onSuccess = function(deletedProduct) {
  // Executed when product is successfully deleted
	console.log("Successfully deleted the Product", deletedProduct);
}

// Define error callback 
let onError = function(error) {
	// Error is an xhrObject
	console.log("Error while deleting the Product", error);
}

// Call `deleteFromList` using the above callbacks, lid and listItem
swat.deleteFromList(lid, product, onSuccess, onError);

API Parameters

ArgumentTypeDescription
lidguidUnique id of the List to fetch contents
listItemobjectPlease refer Product
onSuccessfunctionCalled when the Product is successfully deleted from the List.
onErrorfunctionCalled when there is an error while deleting the Product.

Sample Response

[
  {
    "_self": "dbs/JkFjAA==/colls/JkFjANdNmCM=/docs/JkFjANdNmCMwXu0CAACABw==/",
    "di": "c3feba7e-c0e0-47cb-be5e-5c32e688fa84",
    "bt": "Swym Marketing",
    "_attachments": "attachments/",
    "_rid": "JkFjANdNmCMwXu0CAACABw==",
    "dt": "12 Inches Round Rose Gold Frame Wall Mirror",
    "cts": 1680008384993,
    "empi": 7096437407942,
    "_ts": 1680008384,
    "sku": "45",
    "_etag": "\"74018012-0000-0800-0000-6422e4c00000\"",
    "lid": "59179e9f-139d-4857-bcdd-3ad88a38b47d",
    "du": "https://demo.swym.it/products/12-inches-round-rose-gold-frame-wall-mirror",
    "pid": "KABSbuGyYCuM6/IV7e7cGxT1978LieU1jRdMt6XhYfo=",
    "epi": 41255230701766,
    "id": "d71c2732-89df-4861-9c27-3289df4861ca",
    "uts": 1680008384993,
    "_pkey": "c3feba7e",
    "iu": "https://cdn.shopify.com/s/files/1/0534/3635/0662/products/12InchesRoundRoseGoldFrameWallMirror_620x620.jpg?v=1637593774",
    "_t": 2,
    "pr": 200
  }
]

Other References

Product

An object containing params required for creating, updating or deleting list items

let product = {
  epi: epi, // one unique list item (empi+epi) per listid
  empi: empi,
  du: du,
  qty: qty,
  note: note, //optional
  cprops: {} // Optional custom attributes
};
--data-urlencode 'epi: {{epi}}' \ # One unique list item (empi+epi) per listid
--data-urlencode 'empi: {{empi}}' \ 
--data-urlencode 'du: {{du}}' \
--data-urlencode 'qty: {{qty}}' \
--data-urlencode 'note: {{note}}' \
--data-urlencode 'cprops: {{JSON stringified cprops}}' \ # Optional custom attributes
Property NameData TypeRequiredDescription
product.epiint/stringYesVariant id of the product to be added
product.empiint/stringYesProduct id of the product to be added
product.dustringYesCanonical uri of the product to be added
product.qtyintoptionalDefaults to 1. Quantity included for the add action
product.notestringoptionalOptional note
product.cpropsobjectoptionalMap of custom fields
product.lblsarrayoptionalArray of strings indicating labels, rooms, etc. for HTC. Only one value supported in array. eg: ["Room1"]
product._avbooloptionaltrue if the list action was done without user explicitly picking a variant. Can be used by Wishlist UX to require user to pick variant before adding to cart