We've added a new parameter, sponsoredCount
, to the search query. This parameter gives more control over the number of sponsored products returned in your store’s search results.
⚠️ Extension API users: If you are using the
ClientProductGallery
fragment, this change may cause errors. Make sure your implementation is updated to handle thesponsoredCount
parameter accordingly by following the instructions in the next section.
What needs to be done?
- Open your FastStore project using your preferred code editor.
- Update your FastStore project to version
3.0.157
or later, by running the following:
yarn upgrade -L --scope @faststore
- Run
yarn build
.
API extension users
If you are using the ClientProductGallery
fragment, after updating the store version to the latest one, you may encounter the following error:
[FAILED] GraphQL Document Validation failed with 1 errors;
[FAILED] Error 0: Fields "search" conflict because they have differing arguments. Use different aliases on the fields to fetch both if this was intentional.
[FAILED] at /Users/fanny.chien/Work/faststore.store/.faststore/src/sdk/product/usePageProductsQuery.ts:11:5
[FAILED] at /Users/fanny.chien/Work/faststore.store/.faststore/src/sdk/product/usePageProductsQuery.ts:3:5
[SUCCESS] Generate outputs
Running 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.
import { gql } from "@faststore/core/api";
export const fragment = gql(`
fragment ClientManyProducts on Query {
search(
first: $first
after: $after
sort: $sort
term: $term
selectedFacets: $selectedFacets
sponsoredCount: $sponsoredCount // Add this parameter!
) {
…
}
}
`);
- Save the changes.
- Run
yarn build
once again.