Appearance
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
Name | Type | Description |
---|---|---|
items | ComputedRef<Array<string>> | Wishlist items (Product IDs) |
count | ComputedRef<number> | Wishlist items count |
Methods
Name | Type | Description |
---|---|---|
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 |