Documentation
Feedback
Guides

Release Notes
Release Notes
Added
FastStore: Improved search query with the `sponsoredCount` parameter
December, 20

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 the sponsoredCount 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:

  1. Open your FastStore project using your preferred code editor.

  2. Update your FastStore project to version 3.0.157 or later, by running the following:


    _10
    yarn upgrade -L --scope @faststore

  3. 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
_10
Running lifecycle hook "afterStart" scripts...

To fix it, follow these steps:

  1. Go to the file where you are using the ClientManyProducts fragment, and add the missing sponsoredCount parameter. For example:


    _16
    import { gql } from "@faststore/core/api";
    _16
    _16
    export const fragment = gql(`
    _16
    fragment ClientManyProducts on Query \{
    _16
    search(
    _16
    first: $first
    _16
    after: $after
    _16
    sort: $sort
    _16
    term: $term
    _16
    selectedFacets: $selectedFacets
    _16
    sponsoredCount: $sponsoredCount
    _16
    ) \{
    _16
    _16
    \}
    _16
    \}
    _16
    `);

  2. Save the changes.

  3. Run yarn build once again.

Was this helpful?
Yes
No
On this page