Skip to content
On this page

useSyncWishlist

Definition

Composable to manage wishlist via API

Basic usage

ts
const { 
 items,
 count,
 getWishlistProducts,
 mergeWishlistProducts,
 addToWishlistSync,
 removeFromWishlistSync 
} = useSyncWishlist();

Signature

ts
export function useSyncWishlist(): UseSyncWishlistReturn 

Return type

See UseSyncWishlistReturn
ts
export type UseSyncWishlistReturn = {
  /**
   * Get products from wishlist
   */
  getWishlistProducts(): void;
  /**
   * Merge products with wishlist already existing in API wishlist
   */
  mergeWishlistProducts(itemsToMerge: string[]): void;
  /**
   * Add product to wishlist
   */
  addToWishlistSync(id: string): void;
  /**
   * Remove product from wishlist
   */
  removeFromWishlistSync(id: string): void;
  /**
   * Wishlist items (Product IDs)
   */
  items: ComputedRef<string[]>;
  /**
   * Wishlist items count
   */
  count: ComputedRef<number>;
};

Properties

NameTypeDescription
items
ComputedRef<Array<string>>
Wishlist items (Product IDs)
count
ComputedRef<number>
Wishlist items count

Methods

NameTypeDescription
getWishlistProducts
void
Get products from wishlist
mergeWishlistProducts
void
Merge products with wishlist already existing in API wishlist
addToWishlistSync
void
Add product to wishlist
removeFromWishlistSync
void
Remove product from wishlist
useSyncWishlist has loaded