createWishlist()
createWishlist(
title):Promise<ErrorResult|SuccessResult<WishlistSdkDto>>
Creates a new wishlist with the specified title.
Parameters
| Parameter | Type | Description |
|---|---|---|
title | string | The title for the new wishlist |
Returns
Promise<ErrorResult | SuccessResult<WishlistSdkDto>>
Promise that resolves to a success result with the created wishlist or rejects with an error
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);
}