var buttonInfo = {
ButtonClassElement: string,
ProductId: number,
ProductLink: string,
ProductVariantId: number,
ProductPrice: number,
ProductTitle: string,
ProductImage: string,
ButtonMode: string,
WishlistHash: string
};
WishListHero_SDK.InitializeAddToWishListButton(buttonInfo)
Initialize Add To WishList Button
InitializeAddToWishListButton(buttonInfo)
Initializes a new add to wishlist button. Please refer to the example below.
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 used to create a new add to wishlist button to a an HTML div of your choice,
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 "GetWishListItems" API.
Arguments
Argument
Type
Description
ButtonClassElement
string
Requiredthe class element of the button to be initialized as add to wishlist button
ProductId
number
Requiredthe product id of the item to be added to wishlist
ProductLink
string
Required
ProductVariantId
number
Required
ProductPrice
number
Required
ProductTitle
string
Required
ProductImage
string
RequiredImage-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
ButtonMode
string
Required
the shape of the button you need to initialize, you can choose one of the below modes i.e:
1- icon_only : the button will appear as just an icon i.e: heart, bookmark, star
2- text_only : the button will appear as just text i.e: add to wishlist
3- text_with_icon : the button will appear as text with an icon
4- button_only : the button will appear as a button with text inside
5- button_with_icon : the button will appear as a button with text and icon inside