diff --git a/framework/commercelayer/wishlist/use-add-item.tsx b/framework/commercelayer/wishlist/use-add-item.tsx index 1d4ee532e..3fade3d5b 100644 --- a/framework/commercelayer/wishlist/use-add-item.tsx +++ b/framework/commercelayer/wishlist/use-add-item.tsx @@ -6,11 +6,11 @@ export function emptyHook() { const localWishlist = localStorage.getItem('wishlist') if (localWishlist) { wishlist = JSON.parse(localWishlist) - if (!wishlist.includes(options.variantId)) { - wishlist.push(options.variantId) + if (!wishlist.includes(options.productId)) { + wishlist.push(options.productId) } } else { - wishlist.push(options.variantId) + wishlist.push(options.productId) } localStorage.setItem('wishlist', JSON.stringify(wishlist)) return wishlist diff --git a/framework/commercelayer/wishlist/use-remove-item.tsx b/framework/commercelayer/wishlist/use-remove-item.tsx index 4d3de01ce..860e40883 100644 --- a/framework/commercelayer/wishlist/use-remove-item.tsx +++ b/framework/commercelayer/wishlist/use-remove-item.tsx @@ -11,7 +11,7 @@ export function emptyHook(options?: Options) { wishlist = wishlist.filter((p: string) => p !== id) } localStorage.setItem('wishlist', JSON.stringify(wishlist)) - return Promise.resolve() + return wishlist } return useEmptyHook diff --git a/framework/commercelayer/wishlist/use-wishlist.tsx b/framework/commercelayer/wishlist/use-wishlist.tsx index 8a8d12f72..bed42f4ce 100644 --- a/framework/commercelayer/wishlist/use-wishlist.tsx +++ b/framework/commercelayer/wishlist/use-wishlist.tsx @@ -41,8 +41,9 @@ export function extendHook( const wishlist = JSON.parse(getWishlist) const items = wishlist.map((wishlist: string) => { const [product] = data.products.filter((p) => p.id === wishlist) as any + const [variant] = product.variants return { - variant_id: wishlist, + variant_id: variant.id, product_id: wishlist, id: wishlist, product,