Shopify API not returning all orders

I am trying to retrieve all revenue from a shopify store by downloading all orders from the API, and summing the total sales amount from each order, however the API doesn’t seem to return all orders that I can see through the interface and thus the revenue amount is also not matching.

Some context:

I do have permission to pull all historical orders

I have played around with filters, and have tried filtering by status:ANY and fulfillment_status:ANY, but the numbers never match up to the interface.

Here is the code for my graphql query:

"query": """
        {
          orders(query: \"created_at:>=#{start_date} AND created_at:<=#{end_date} AND status:ANY AND fullfillment_status:ANY\") {
            edges {
              node {
                createdAt
                processedAt
                currentTotalPriceSet {
                  presentmentMoney {
                    amount
                  }
                }
                cancelReason
                cancelledAt
                displayFulfillmentStatus
                publication {
                  id
                  name
                }   
                id
              }
            }
          }
        }
      """

When my start date is “2021-10-01” and end date is “2021-10-31”, I would expect it to pull all 1482 orders in October, but it only pulls 1470. When I filter through the results I see varying fulfillment statuses so I know the filters are working correctly.

My goal is simply to get the Total Sales number from the Sales over time report in the analytics tab, if anyone can help I’d be really grateful.

Thanks!

Hello @Humming_bird ,

Did you try to offset your dates by your timezone ?