Skip to content

Instantly share code, notes, and snippets.

@webmarked
Last active March 25, 2020 16:59
Show Gist options
  • Save webmarked/7e7023e250aae3071dbc86d271fa9856 to your computer and use it in GitHub Desktop.
Save webmarked/7e7023e250aae3071dbc86d271fa9856 to your computer and use it in GitHub Desktop.
Sample Smart Wishlist public API implementation
//This jQuery based code fetches the contents of Express Wishlist (unregistered users)
var wishlistid=SWGetExpressWishlistId();
$.ajax({
url: "/a/wishlist?type=api&wishlistid="+wishlistid+"&version=1",
dataType: "json",
cache:false,
success: function(data) {
//your code for displaying the wishlist data.
}
});
//the above code adapted for customer wishlist (logged in users)
var customerid=SWGetCustomerWishlistId();
if(customerid!=0) //check if user is logged in
{
$.ajax({
url: "/a/wishlist?type=api&customerid="+customerid+"&version=1",
dataType: "json",
cache:false
success: function(data) {
//your code for displaying the wishlist data.
}
});
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment