Fetch List Contents
Fetch only the List Contents.
swat.fetchListCtx
Returns an array of ListContents (products) for the List with a given lid.
Used to fetch the List Contents present in a given List.
Things to considerThis API is similar to fetchListDetails but returns only the list items.
Definition
swat.fetchListCtx(listConfig, onSuccess, onError)
Example
Here's an example of how you can use this API to fetch List Contents of a List called black Friday list:
// define the list config
let listConfig = {
"lid": "59179e9f-139d-4857-bcdd-3ad88a38b47d", // lid
};
// Define success callback
let onSuccess = function(listContents) {
// successfully fetched list contents
console.log("Successfully fetched List Contents", listContents);
}
// Define error callback
let onError = function(error) {
// Error is an xhrObject
console.log("Error fetching List Contents", error);
}
swat.fetchListCtx(listConfig, onSuccess, onError);API Parameters
| Argument | Type | Description |
|---|---|---|
| listConfig | object | An object containing the unique id of the List to fetch its contents. |
| onSuccess | function | Called when the List Contents are successfully fetched. |
| onError | function | Called when there is an error while fetching the List Contents. |
Success Response
The success response contains an array of List Contents present in the given List. Each List Item has information like its empi, epi, quantity etc.
Product metadata source of truthThe response can include product metadata such as title, price, image URL, product URL, SKU, and variant details. Use these returned values only for the initial render. Before relying on product details for pricing, availability, display, cart, or checkout flows, fetch the current product and variant data from Shopify using the Storefront API ProductVariant object.
[
{
"bt":"Swym Marketing",
"cby":null,
"ct":null,
"cts":1679598072363,
"di":"fb283019-487b-4447-99e6-133178f6477e",
"dt":"12 Inches Round Rose Gold Frame Wall Mirror",
"du":"https://demo.swym.it/products/12-inches-round-rose-gold-frame-wall-mirror",
"empi":7096437407942,
"epi":41255230701766,
"id":"5d054a90-a2b2-4f9d-854a-90a2b2ef9d68",
"iu":"https://cdn.shopify.com/s/files/1/0534/3635/0662/products/12InchesRoundRoseGoldFrameWallMirror_620x620.jpg?v=1637593774",
"lid":"313bef26-16b4-4861-be1b-c986f6ac5871",
"pid":"/IV7e7cGxT1978LieU1jRdMt6XhYfo=",
"pr":200,
"product":{
"bt":"Swym Marketing",
"cby":null,
"cts":1679598072363,
"di":"fb283019-487b-4447-99e6-133178f6477e",
"dt":"12 Inches Round Rose Gold Frame Wall Mirror",
"du":"https://demo.swym.it/products/12-inches-round-rose-gold-frame-wall-mirror?variant=41255230701766",
"empi":7096437407942,
"epi":41255230701766,
"id":"5d054a90-a2b2-4f9d-854a-90a2b2ef9d68",
"iu":"https://cdn.shopify.com/s/files/1/0534/3635/0662/products/12InchesRoundRoseGoldFrameWallMirror_620x620.jpg?v=1637593774",
"lid":"313bef26-16b4-4861-be1b-c986f6ac5871",
"pid":"/IV7e7cGxT1978LieU1jRdMt6XhYfo=",
"pr":200,
"prodtype":null,
"sku":"45",
"title":"12 Inches Round Rose Gold Frame Wall Mirror",
"uby":null,
"uri":"https://demo.swym.it/products/12-inches-round-rose-gold-frame-wall-mirror?variant=41255230701766",
"uts":1679598072363,
"_pkey":"fb283019",
"_t":2,
"raw-du":"https://demo.swym.it/products/12-inches-round-rose-gold-frame-wall-mirror"
}
}
]Updated 20 days ago