Product Discovery Functions
The Product Discovery drop-in provides API functions that enable you to programmatically control behavior, fetch data, and integrate with Adobe Commerce backend services.
| Function | Description |
|---|---|
search | Performs a product search based on the parameters. |
search
Section titled “search”The search function performs a product search based on the parameters. It updates the search context and emits events consumed by containers such as SearchResults, Facets, Pagination, and SortBy.
Passing null as the request parameter clears the current search state and resets related containers.
const search = async ( request: SearchVariables | null, options: SearchOptions = {}): Promise<ProductSearchResult>| Parameter | Type | Req? | Description |
|---|---|---|---|
request | SearchVariables | null | Yes | Search variables including `phrase` (search term), `pageSize` (results per page), `currentPage` (page number), `filter` (array of filter conditions), and `sort` (array of sort criteria). Pass `null` to clear the search state. |
options | SearchOptions | No | Optional search configuration options. |
Events
Section titled “Events”Emits the search/loading, search/result, and search/error events during the search lifecycle to update containers with search state and results.
Returns
Section titled “Returns”Returns ProductSearchResult.
Data Models
Section titled “Data Models”The following data models are used by functions in this drop-in.
ProductSearchResult
Section titled “ProductSearchResult”The ProductSearchResult object is returned by the following functions: search.
interface ProductSearchResult { facets: SearchFacet[]; items: Product[]; pageInfo: { currentPage: number; totalPages: number; totalItems: number; pageSize: number; }; suggestions?: string[]; totalCount: number; metadata?: { filterableAttributes: RefineOption[]; sortableAttributes: RefineOption[]; };}