var productInfo = {
CustomerId: number,
ProductId: number,
ProductTitle: string,
ProductPrice: number,
ProductLink: string,
ProductVariantId: number,
ProductImage: string,
WishlistHash: string
};
var added = await window.WishListHero_SDK.AddWishListItem(productInfo)
Add WishList Item
AddWishListItem(productInfo)
Adds a new wishlist event. Please refer to the example. You can call this method once the window.WishListHero_SDK object is initialized. This API operates at the product variant level as set by the store.
This API can be called in the below scenarios,
- 'onclick' button on a product page
- 'onclick' button on a product quick view
- 'onclick' buttons on a collections page with multiple products
- 'onclick' buttons on a widget of multiple products, Eg: related products, top wishlist products, etc.
Tip Before showing a button for 'Add to Wishlist', it is best to first check if the product or variant is already in the wishlist, by using the "GetWishListItemsFromServer" API.
Arguments
Argument
Type
Description
ProductId
number
Required
the product id of the item to be added to wishlist
ProductLink
string
Required
ProductVariantId
number
Required
ProductPrice
number
Required
ProductTitle
string
Required
ProductImage
string
Required
Image-uri Without protocol so protocol can be decided while rendering to http or https
Example:
//cdn.shopify.com/s/files/1/0549/7936/2971/products/5-panel-hat_4ee20a27-8d5a-490e-a2fc-1f9c3beb7bf5_1024x.jpg?v=1614781409
CustomerId
number
Optional
WishlistHash
string
Required