getWishlists
Retrieves all wishlists with their items.
sdk.wishlists.methods.getWishlists()getWishlists(): Promise<ErrorResult | SuccessResult<WishlistSdkDto[]>>Returns
Promise<ErrorResult | SuccessResult<WishlistSdkDto[]>>Promise that resolves to a success result with an array of wishlists or rejects with an error
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.getWishlists()
.then((response) => {
console.log('Wishlists:', response.result);
})
.catch(console.error);
});
}
if (window.gw && window.gw.sdk) {
onSdkReady();
} else {
document.addEventListener("gwSdkReady", onSdkReady);
}