Skip to content
Shopware

useSyncWishlist

useSyncWishlist

Category:
Wishlist

Composable to manage wishlist via API

Types

ts
export function useSyncWishlist(): UseSyncWishlistReturn

source code

ts
export type UseSyncWishlistReturn = {
  /**
   * Get products from wishlist
   */
  getWishlistProducts(
    defaultSearchCriteria?: Schemas["Criteria"],
  ): Promise<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>;
  /**
   * Current page number
   */
  currentPage: ComputedRef<number>;
  /**
   * Limit number of products per page
   */
  limit: ComputedRef<number>;
  /**
   * Wishlist products
   */
  products: ComputedRef<Schemas["Product"][]>;
  /**
   * Indicates if the wishlist is loading
   */
  isLoading: Ref<boolean>;
};

source code