Skip to content
On this page

useProductWishlist ​

Definition ​

Manage wishlist for a single product.

Basic usage ​

ts
const { 
 isInWishlist,
 removeFromWishlist,
 addToWishlist 
} = useProductWishlist(productId);

Signature ​

ts
export function useProductWishlist(
  productId: string,
): UseProductWishlistReturn 

Parameters ​

NameTypeDescription
productId
string

Return type ​

See UseProductWishlistReturn
ts
export type UseProductWishlistReturn = {
  /**
   * Removes product from wishlist
   */
  removeFromWishlist(): Promise<void>;
  /**
   * Adds product to wishlist
   */
  addToWishlist(): Promise<void>;
  /**
   * Indicates whether a product is in wishlist
   */
  isInWishlist: Ref<boolean>;
};

Properties ​

NameTypeDescription
isInWishlist
Ref<boolean>
Indicates whether a product is in wishlist

Methods ​

NameTypeDescription
removeFromWishlist
Promise<void>
Removes product from wishlist
addToWishlist
Promise<void>
Adds product to wishlist
useProductWishlist has loaded