Skip to content
On this page

useProductWishlist

Definition

Manage wishlist for a single product.

Basic usage

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

Signature

ts
export function useProductWishlist(
  product: Ref<Product>
): UseProductWishlistReturn 

Parameters

NameTypeDescription
product
Ref<Product>

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