Fetch Saved Cart Products [Beta]
Fetch Products that have been saved to cart by shopper
Contact support for using Beta Shopper APIs.
swat.shopper.fetchSavedCartProducts
This API retrieves the products that are saved to their cart by a shopper. For logged-in shoppers, all products saved to their cart are retrieved, while for non-logged-in shoppers, all products saved to the cart in their session on the device are retrieved. By default, the API returns a maximum of 12 latest products that are saved to the cart.
Definition
swat.shopper.fetchSavedCartProducts(onSuccess, onError)
Example
Here's an example of how you can use this API to fetch the Saved to-Cart products:
// Define success callback
let onSuccess = function(data) {
// Successfully fetched the products saved to cart
console.log("These are the products added to cart by the shopper : ", data.savedCart);
}
// Define error callback
let onError = function(error) {
// Error is an xhrObject
console.log("Error while fetching the shopper activity ", error);
}
// Call `shopper.fetchSavedCartProducts` function
swat.shopper.fetchSavedCartProducts(onSuccess, onError);API Parameters
| Argument | Type | Description |
|---|---|---|
| onSuccess | function | Called when the Products saved to cart are fetched successfully. |
| onError | function | Called when there is an error while fetching Products saved to cart |
Success Response
The success response contains by default, a maximum of 12 Saved to cart products in the savedCart key.
{
"savedCart": [
{
// Product ID from the Platform
"productId": 7096231231686,
// Timestamp at which the product was added to cart
"lastSavedTime": 1709013095458,
// Varaint ID form the Platform
"variantId": 41254655393990,
// Produc URL
"productURL": "https://demo.swym.it/products/ceramic-oval-basin",
// Timestamp of the latest order placed with the product after it was added to cart
"lastOrderTimestamp": 1708426159001,
// ID of the variant that was ordered after the product was added to cart
"lastOrderedVariantId": 41254655393990,
// ID of the latest order placed with the product after it was added to cart
"lastOrderId": 2849832
}
]
}Other References
Saved Cart Fields
| Argument | Type | Description |
|---|---|---|
| productId | number | Product ID from the Platform |
| lastSavedTime | number | The timestamp at which the product was added to cart |
| productURL | string | Product URL |
| variantId | number | Variant ID from the Platform |
| lastOrderTimestamp | number | Timestamp of the latest order placed with the product after it was added to cart |
| lastOrderId | number | ID of the latest order placed with the product after it was added to cart |
| lastOrderedVariantId | number | ID of the variant that was ordered after the product was added to cart |
Updated 3 months ago
