Skip to main content

createWishlist

Creates a new wishlist with the specified title.

Usage example​

Ensure the SDK and the WishlistsSdk module are ready:

function onSdkReady() {
const moduleName = window.gw.sdk.common.constants.modules.WISHLISTS;
window.gw.sdk.runIfModuleReady(moduleName, () => {
window.gw.sdk.wishlists.methods.createWishlist("My New Wishlist")
.then((response) => {
console.log('Created wishlist:', response.result);
})
.catch(console.error);
});
}

if (window.gw && window.gw.sdk) {
onSdkReady();
} else {
document.addEventListener("gwSdkReady", onSdkReady);
}