Skip to content

Search Actions

Retrieves products for a search query.

import { fetchSearchResults } from '@shopgate/engage/search';
const params = {
offset: 0,
searchPhrase: 'shoes',
limit: 3,
sort: 'priceAsc',
}
dispatch(fetchSearchResults(params));
  • params (Object) required: The parameters for the products to request.
    • searchPhrase (string) required: The search phrase.
    • limit (number): The amount of items to get with a single request. Default is 30.
    • offset (number): The offset for the request. Default is 0.
    • sort (string): The sort scheme. Default is by relevance.
      • Possible Values: relevance, priceAsc, priceDesc, random. All of these values are prepared as constants. Those can be imported like this:
import { SORT_RELEVANCE, SORT_PRICE_ASC, SORT_PRICE_DESC, SORT_RANDOM } from '@shopgate/engage/core';

Retrieves suggestions for the currently ongoing search.

import { fetchSearchSuggestions } from '@shopgate/engage/search';
const searchPhrase = 'red';
dispatch(fetchSearchSuggestions(searchPhrase));
  • searchPhrase (string) required: The search phrase.