Search code examples
graphqlshopify

how to pull all data after a specific order?


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?


Solution

  • 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.