Appearance
useProductSearch ​
Definition ​
Composable for product search.
Basic usage ​
ts
const { search } = useProductSearch();
Signature ​
ts
export function useProductSearch(): UseProductSearchReturn
Return type ​
See UseProductSearchReturn
ts
export type UseProductSearchReturn = {
/**
* Searches for a product by its id
* @param productId
* @param options - optional parameters accepts `withCmsAssociations` flag to fetch cms-related associations and criteria
* @returns {Promise<Schemas['ProductDetailResponse']>}
*/
search: (
productId: string,
options?: UseProductSearchReturnOptions,
) => Promise<Schemas["ProductDetailResponse"]>;
};
Properties ​
Name | Type | Description |
---|---|---|
search | ( productId: string, options?: UseProductSearchReturnOptions, ) => Promise<Schemas["ProductDetailResponse"]> | Searches for a product by its id |
Usage ​
ts
import { useProductSearch } from "@shopware-pwa/composables-next";
const { search } = useProductSearch();