Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

EDU-14041: [Release note] FastStore: Improved search query with the sponsoredCount parameter #1645

Merged
merged 3 commits into from
Dec 20, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -58,5 +58,4 @@ To enable the gift card data analysis at your anti-fraud provider, follow the st
2. Open a ticket with [VTEX Support](https://help.vtex.com/support) requesting the provider integration update.
3. Contact VTEX merchants with whom you have contracts to inform them about the availability of this new anti-fraud analysis service.


> ⚠️ Learn more in the [Announcement Anti-fraud analysis for gift cards](https://help.vtex.com/en/announcements/anti-fraud-analysis-for-gift-cards).
> ⚠️ Learn more in the [Announcement Anti-fraud analysis for gift cards](https://help.vtex.com/en/announcements/anti-fraud-analysis-for-gift-cards).
64 changes: 64 additions & 0 deletions docs/release-notes/2024-12-20-new-sponsored-count-parameter.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
---
title: "FastStore: Improved search query with the `sponsoredCount` parameter"
slug: "2024-12-20-new-sponsored-count-parameter"
hidden: false
type: "added"
createdAt: "2024-12-20T00:00:00.219Z"
excerpt: "FastStore projects now include a new parameter to improve the management of sponsored product search results."
---

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`](https://developers.vtex.com/docs/guides/faststore/api-extensions-extending-queries-using-fragments#clientproductgalleryquery) 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](#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:

```bash
yarn upgrade -L --scope @faststore
```

3. Run `yarn build`.

### API extension users

If you are using the [`ClientProductGallery`](https://developers.vtex.com/docs/guides/faststore/api-extensions-extending-queries-using-fragments#clientproductgalleryquery) fragment, you may encounter the following error after upgrading your FastStore version:

```bash
[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:

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

```ts mark=8
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!
) {
}
}
`);
```

2. Save the changes.
3. Run `yarn build` once again.
Loading