Search Actions
fetchSearchResults
Retrieves products for a search query.
Usage
import { fetchSearchResults } from '@shopgate/engage/search';
const params = {
offset: 0,
searchPhrase: 'shoes',
limit: 3,
sort: 'priceAsc',
}
dispatch(fetchSearchResults(params));
Attention: The path to the old modules is deprecated and will be removed in ENGAGE v7:
import { fetchSearchResults } from '@shopgate/pwa-common-commerce/search'
Parameters
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:
- Possible Values:
import { SORT_RELEVANCE, SORT_PRICE_ASC, SORT_PRICE_DESC, SORT_RANDOM } from '@shopgate/engage/core';
Attention: The path to the old modules is deprecated and will be removed in ENGAGE v7:
import { SORT_RELEVANCE, SORT_PRICE_ASC, SORT_PRICE_DESC, SORT_RANDOM } from '@shopgate/pwa-common/constants/DisplayOptions'
fetchSearchSuggestions
Retrieves suggestions for the currently ongoing search.
Usage
import { fetchSearchSuggestions } from '@shopgate/engage/search';
const searchPhrase = 'red';
dispatch(fetchSearchSuggestions(searchPhrase));
Attention: The path to the old modules is deprecated and will be removed in ENGAGE v7:
import { fetchSearchSuggestions } from '@shopgate/pwa-common-commerce/search'
Parameters
searchPhrase
(string) required: The search phrase.