SearchActions (Commerce Engine)

This is for:

Developer

The search action creators.

Loader Function

loadSearchActions

Loads the commerce search reducer and returns the available search action creators.

Parameters

  • engine: CommerceEngine

    The headless commerce engine.

Returns SearchActionCreators: The search action creators.

SearchActionCreators

executeSearch

Executes a search query.

Returns AsyncThunkAction<QuerySearchCommerceAPIThunkReturn, void, AsyncThunkCommerceOptions<StateNeededByExecuteSearch>>: A dispatchable action.

fetchMoreProducts

Fetches and additional page of products and appends it to the current list.

Returns AsyncThunkAction<QuerySearchCommerceAPIThunkReturn | null, void, AsyncThunkCommerceOptions<StateNeededByExecuteSearch>>: A dispatchable action.

prepareForSearchWithQuery

Updates the query, resets the pagination, and optionally clears all facets in preparation for a new search query.

Parameters

  • payload: UpdateQueryPayload & PrepareForSearchWithQueryOptions

    The action creator payload.

Returns AsyncThunkAction<void, PrepareForSearchWithQueryPayload, AsyncThunkCommerceOptions<StateNeededByExecuteSearch>>: A dispatchable action.

promoteChildToParent

Promotes a child product to a parent product.

Parameters

Returns PayloadAction<PromoteChildToParentPayload>: A dispatchable action.

PromoteChildToParentPayload

Properties

  • child: Omit<BaseProduct, 'children' | 'totalNumberOfChildren'>

  • query: string

    The initial basic query expression for instant products.

  • id: string

    The search box ID.