Skip to content
On this page

useSyncWishlist ​

Definition ​

Composable to manage wishlist via API

Basic usage ​

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

Signature ​

ts
export function useSyncWishlist(): UseSyncWishlistReturn 

Return type ​

See UseSyncWishlistReturn
ts
export type UseSyncWishlistReturn = {
  /**
   * Get products from wishlist
   */
  getWishlistProducts(
    defaultSearchCriteria?: operations["searchPage post /search"]["body"],
  ): 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
   */
  totalWishlistItemsCount: Ref<number>;
};

Properties ​

NameTypeDescription
items
ComputedRef<Array<string>>
Wishlist items (Product IDs)
totalWishlistItemsCount
Ref<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