deleteWishlistItem()
deleteWishlistItem(
productId,variantId?,wishlistId?):Promise<Success|ErrorResult>
Removes a wishlist item using productId, variantId and wishlistId parameters.
Parameters
| Parameter | Type | Description |
|---|---|---|
productId | number | 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
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);
}