Skip to main content

getWishlists()

getWishlists(): Promise<ErrorResult | SuccessResult<WishlistSdkDto[]>>

Retrieves all wishlists with their items.

Returns​

Promise<ErrorResult | SuccessResult<WishlistSdkDto[]>>

Promise that resolves to a success result with an array of wishlists 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.getWishlists()
.then((response) => {
console.log('Wishlists:', response.result);
})
.catch(console.error);
});
}

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