Graphql Commerce API stats field not working for search queries

Using Discovery Search through REST APIs returns stats field data for price as max and min, while the same query does not work for the Graphql

Which version of Graphql Commerce API are you using ?

It should be part of the QueryHint field

query {
  findItemsByKeyword(
   ...
  ) {
    queryHint {
      statsFields {
        listPrice {
          max
          min
        }
        purchasePrice {
          max
          min
        }
      }
    }
  }
}
1 Like

Not, sure how to check the version, but we are using the endpoint for our staging:
https://graphql-commerce-preprod.bloomreach.io/graphql

And, yes, using the same queryHint

Hi,

please add the following to the queryHint

query {
  findItemsByKeyword(
   ...
   queryHint: { params: { name: "stats.field", values: ["price,sale_price"] } }
  ) {
    queryHint {
      statsFields {
        listPrice {
          max
          min
        }
        purchasePrice {
          max
          min
        }
      }
    }
  }
}
1 Like