Pull amount of orders on hold?

Hey there, I am building a dashboard for our managers to see the analytics throughout all of our integrations, one of them being shiphero. I’d like to display how many orders we currently have on hold for either a fraud or invalid shipping address. Am I able to pull that information using GraphQL or any other form of API?

Hello @Metrelli!

We do not have a query that returns that number nor the IDs of orders on hold.

The best way would be to query using the orders mutation and polling those fields on it. Something like this:

query{
  orders(updated_from:"ISODateTime"){
    data(first:10){
      edges{
        node{
          legacy_id
          holds{
            fraud_hold
            address_hold
          }
        }
      }
      pageInfo{
        hasNextPage
        endCursor
      }
    }
  }
}

The best approach to do so without expending all your credits is using pagination, and for example, every hour query the last hour using the updated_from with the value of right now -1 hour.

Instead of getting every order, you will get those updated in the last hour. You analyze those hold fields and see if any return true.

Please let me know if you need further help.

Have a nice day!
TomasFD

@tomasfd, got it. Does each order pulled in this use a credit? For example, how many credits are used in the code given above?