We've added a new parameter, sponsoredCount
, to FastStore's search query. This new parameter allows you to control the number of sponsored products displayed in your store’s search results, providing more flexibility in managing search relevance and sponsored content.
Extension API users: If you are using the
ClientProductGallery
fragment, this change may cause errors. To prevent issues, ensure your implementation is updated to handle thesponsoredCount
parameter by following the instructions in the API Extension Users section below.
What needs to be done?
To enable this new feature in your FastStore project, follow these steps:
-
Open your FastStore project using your preferred code editor.
-
Update your FastStore project to version
3.0.157
or later, by running the following:_10yarn upgrade -L --scope @faststore -
Run
yarn build
.
API extension users
If you are using the ClientProductGallery
fragment, you may encounter the following error after upgrading your FastStore version:
_10[FAILED] GraphQL Document Validation failed with 1 errors;_10[FAILED] Error 0: Fields "search" conflict because they have differing arguments. Use different aliases on the fields to fetch both if this was intentional._10[FAILED] at /Users/fanny.chien/Work/faststore.store/.faststore/src/sdk/product/usePageProductsQuery.ts:11:5_10[FAILED] at /Users/fanny.chien/Work/faststore.store/.faststore/src/sdk/product/usePageProductsQuery.ts:3:5_10[SUCCESS] Generate outputs_10Running lifecycle hook "afterStart" scripts...
To fix it, follow these steps:
-
Go to the file where you are using the
ClientManyProducts
fragment, and add the missingsponsoredCount
parameter. For example:_16import { gql } from "@faststore/core/api";_16_16export const fragment = gql(`_16fragment ClientManyProducts on Query \{_16search(_16first: $first_16after: $after_16sort: $sort_16term: $term_16selectedFacets: $selectedFacets_16sponsoredCount: $sponsoredCount_16) \{_16…_16\}_16\}_16`); -
Save the changes.
-
Run
yarn build
once again.