skip to Main Content

I am looking for a way to build a graphQL query to pull order data after a specific order id.
I am using REST today and achieve this by running database query to pull the last loaded order. I then make a call to Shopify and specify:&since_id=<last_loaded_order>.
I’ve looked into examples on Shopify and cannot find the way to do the same thing in graphQL.
Could someone share a link or a snippet of how to do it?

2

Answers


  1. You can take the order creation date and run a query like this

    orders(first:100, query:"created_at:>'2024-30-11T00:00:00Z'") {
       edges {
          node {
               id
               ...
          }
       }
    
    }
    

    Where 2024-30-11T00:00:00Z is the created_at date of the order. (Note the ”)

    Login or Signup to reply.
  2. You can filter orders by id

    Example:

    query($query: String) {
        orders(first: 250, query: "id:>=5834352591016", sortKey: PROCESSED_AT) {
            edges {
                node {
                    id
                    name
                    processedAt
                }
            }
        }
    }
    
    

    Note: id is Shopify order id.

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search