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

feat(crossSelling): parametrize groupByProduct parameter #460

Conversation

pedrobernardina
Copy link

@pedrobernardina pedrobernardina commented Aug 9, 2023

What problem is this solving?

  • Parameterize groupByProduct param on crossSelling method of the search client
  • Add groupByProduct param to productRecommendations query.
  • Add quantity param to Recommendation.similars resolver.

These are necessary for the resolver to return more than 12 similar products.

In the Fashion segments it's common to have different product colours as different (similar) products instead of SKUs due to the limited number of SKUs we can have on the platform. There's a limitation in the current implementation that caps the number of similar products to 12, forcing us to make extra API calls.

This MR parameterize the (currently hardcoded) control variable groupByProduct in a backwards compatible way.
There's also an MR in vtex.search-graphql that updates the necessary schemas.

How should this be manually tested?

GraphQL IDE on the following Workspace

Example Queries

query ProductRecommendations(
  $identifier: ProductUniqueIdentifier
  $type: CrossSelingInputEnum
  $groupByProduct: Boolean
) {
  productRecommendations(identifier: $identifier, type: $type, groupByProduct: $groupByProduct) {
    cacheId
    productId
    productName
    productReference
  }
}
{
  "identifier": {
    "field": "id",
    "value": "177"
  },
  "type": "similars",
  "groupByProduct": true  // true is the default value. This is optional
}
query ProductsByIdentifier(
  $field: ProductUniqueIdentifierField!
  $values: [ID!]
) {
  productsByIdentifier(field: $field, values: $values) {
    cacheId
    productId
    productName
    productReference
    recommendations {
      similars(quantity: DEFAULT) { # DEFAULT or ALL_AVAILABLE
        cacheId
      	productId
    		productName
    		productReference
      }
    }
  }
}
{
  "field": "id",
  "values": [21, 177]
}

Checklist/Reminders

  • Updated README.md.
  • Updated CHANGELOG.md.
  • Linked this PR to a Clubhouse story (if applicable).
  • Updated/created tests (important for bug fixes).
  • Deleted the workspace after merging this PR (if applicable).

Screenshots or example usage

Type of changes

✔️ Type of Change
_ Bug fix
✔️ New feature
_ Breaking change
_ Technical improvements

Notes

@vtex-io-ci-cd
Copy link

vtex-io-ci-cd bot commented Aug 9, 2023

Hi! I'm VTEX IO CI/CD Bot and I'll be helping you to publish your app! 🤖

Please select which version do you want to release:

  • Patch (backwards-compatible bug fixes)

  • Minor (backwards-compatible functionality)

  • Major (incompatible API changes)

And then you just need to merge your PR when you are ready! There is no need to create a release commit/tag.

  • No thanks, I would rather do it manually 😞

@iago1501
Copy link
Contributor

Folks, we are going to follow the changes on these 3 PRs:

vtex-apps/shelf#282
vtex-apps/search-graphql#135
#467

Suggest you review, do your tests, and check if they look good for you, basically, I just made a change removing the responsibility of the type of recommendation and adding this responsibility into the recommendation itself, we are going to review here internally and do all merge and deploy process

@iago1501 iago1501 closed this Mar 11, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants