Skip to content
Shopware

useProductSearchSuggest

useProductSearchSuggest

Category:
Product

Composable for product suggest search.

Types

ts
export function useProductSearchSuggest(): UseProductSearchSuggestReturn

source code

ts
export type UseProductSearchSuggestReturn = {
  /**
   * Current search term
   */
  searchTerm: Ref<string>;
  /**
   * Indicates if the search is in progress
   */
  loading: ComputedRef<boolean>;
  /**
   * Performs the search
   * @param additionalCriteria - additional search criteria of type {@link ShopwareSearchParams}
   * @returns
   */
  search(
    additionalCriteria?: Partial<operations["searchPage post /search"]["body"]>,
  ): Promise<void>;
  /**
   * Loads more products for current search criteria
   */
  loadMore(
    criteria: operations["searchPage post /search"]["body"],
  ): Promise<void>;
  /**
   * Returns the product list found by the search
   */
  getProducts: ComputedRef<Schemas["ProductListingResult"]["elements"]>;
  /**
   * Returns the total number of products found by the search
   */
  getTotal: ComputedRef<number>;
};

source code