Skip to main content

deleteWishlistItem

Removes a wishlist item using productId, variantId and wishlistId parameters.

sdk.wishlists.methods.deleteWishlistItem()
function
deleteWishlistItem(productId: number, variantId?: number, wishlistId?: number): Promise<Success | ErrorResult>
Parameters
productIdnumber
ID of the product to be removed from the wishlist
variantId?number
(Optional) Variant ID of the product
wishlistId?number
(Optional) ID of the wishlist from which the item will be removed
Returns
Promise<Success | ErrorResult>

Promise that resolves to a success result 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.deleteWishlistItem(123, 456, 789)
.then(console.log)
.catch(console.error);
});
}

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