Fetch all products
Fetch the list of products added to the user's Save For Later list.
swat.SaveForLater.fetch
Definition
swat.SaveForLater.fetch(lid, onSuccess, onError)
Example
let lid = "7f69f914-d413-48dc-b449-77e9c3ff08e8";
let onSuccess = function(response) {
console.log("Successfully Fetched a Save for Later List", response);
}
let onError = function(error) {
// Error is an xhrObject
console.log("There was an Error, while we tried to fetch the Save For Later List", error);
}
// Call the Init function.
swat.SaveForLater.fetch(lid, onSuccess, onError);
API Parameters
Argument | Type | Description |
---|---|---|
lid | string | list id of the save for later list. |
onSuccess | function | Called when the Save for Later List is successfully fetched. |
onError | function | Called when there is an error while fetching the Save for Later List. |
Response
{
"list": {
"di": "fb283019-487b-4447-99e6-133178f6477e",
"lty": "sfl",
"uid": "8kPqqX6/sOYTTOc0WqrpkhmWttqouvi3wygUngPfiHU=",
"cts": 1679667114911,
"lnote": null,
"lname": "My SFL List",
"cby": "[email protected]",
"lid": "7f69f914-d413-48dc-b449-77e9c3ff08e8",
"pid": "KABSbuGyYCuM6/IV7e7cGxT1978LieU1jRdMt6XhYfo=",
"st": 1,
"cprops": {},
"id": "ba3b87ac-715e-4b9c-bb87-ac715efb9cb0",
"uts": 1679667114911,
"ldesc": {},
"uby": null,
"cfor": null
},
"items": [],
"userinfo": {
"fname": "first name",
"uid": "8kPqqX6/sOYTTOc0WqrpkhmWttqouvi3wygUngPfiHU=",
"m": null,
"em": "[email protected]",
"cts": 1652286963869,
"lname": "last_name",
"pid": "/IV7e7cGxT1978LieU1jRdMt6XhYfo=",
"uts": 1674475641105
},
"pagination": {
"totalcount": 0,
"next": null,
"limit": null
}
}
This information can be used to retrieve or manipulate the Save for Later and List Items in future API calls.
Response Reference
Key Name | Descriptions |
---|---|
list | List Information on Save for Later List |
items | Contains all the items for this user, initially it will be empty. |
userinfo | contains information on the user. |
pagination | pagination. |
Other References.
List
A simple Javascript object containing parameters required for creating a new List
Property Name | Data Type | Required | Description |
---|---|---|---|
lname | string | Yes | List name - unique for a given user, allows 3-50 characters. |
lty | string | Yes | Specifies the type of list you want to create, wl - wishlist, sfl - save for later, this is used to create a different type of list separate from the wishlist` |
fromlid | guid string | optional | Used to duplicate a list, when supplied this lid would be used to duplicate from |
lnote | string | optional | Note you may add to list, that you can fetch at a later time for frontend use |
lprops | object | optional | Custom object that can store attrbiutes of your choice for each list. |
Item
Property Name | Data Type | Required | Description |
---|---|---|---|
epi | int/string | Yes | Variant id of the product to be added |
empi | int/string | Yes | Product id of the product to be added |
du | string | Yes | Canonical uri of the product to be added |
qty | int | optional | Defaults to 1. Quantity included for the add action |
note | string | optional | Optional note |
cprops | object | optional | Map of custom fields |
lbls | array | optional | Array of strings indicating labels, rooms, etc. for HTC. Only one value supported in array. eg: ["Room1"] |
_av | bool | optional | true 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 |
Updated 6 months ago