vtex-apps / store-discussion

VTEX IO store builders' community
80 stars 5 forks source link

Add "productSpecificationGroups" resolver to OrderFormItems #707

Open pedrobernardina opened 9 months ago

pedrobernardina commented 9 months ago

Add resolver "productSpecificationGroups" to Item

In Fashion segment 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. It's impossible to get product specifications (such as colour) in the current orderForm implementation without having to make an extra API call for each item, impacting user experience. For mobile apps this is unfeasible.

We've opened an PR implementing this. https://github.com/vtex-apps/checkout-graphql/pull/191

In the proposed implementation, it would be possible to get this data with the query:

query ProductSpecificationGroups($orderFormId: ID, $refreshOutdatedData: Boolean) {
  orderForm(orderFormId: $orderFormId, refreshOutdatedData: $refreshOutdatedData)   {
    items {
      id
      productSpecificationGroups {
        name
        originalName
        specifications {
          name
          originalName
          values
        }
      }
    }
  }
}