Skip to content

searchForProducers(query: string): Promise<TSearchProducersResponse | null>

The searchForProducers is an asynchronous method that allows you to search for producers based on a given query.

Input parameters

query

query is a mandatory parameter of string type which represents a query to which results should be returned.

Returned value

A returned value is has a type of Promise<TSearchProducersResponse[] | undefined>. You can read more about TSearchProducersResponse here.

Event Bus events

This API method dispatches the following events with the Event Bus:

Example

In this example we make a SearchApi call to get producer results based on a given query.

    useStorefront(async (storefront) => {
        const searchApi = storefront.getApiSync('SearchApi');

        const producers = await searchApi.searchForProducers('Samsung');
    });

Search API methods reference

Objects Reference