2
votes

I want to calculate Gross Sales using Shopify API. I have already readed the shopify API documentation and tried the formula they used to calculate gross sales and failed to get the same result they have at the shopify reports website.

I used this shopify endpoint to retrieve all orders

/admin/api/2020-07/orders.json?status=any&created_at_min=2020-07-03T00:00:00-04:00&created_at_max=2020-07-04T00:00:00-04:00&limit=250

PS: The number of orders from shopify API and shopify Dashboard is equal. ( I am getting all the orders correctly)

I tried to use the sum of total_line_items_price, but I got a different result from Shopify Reports.
Shopify API results after summing the total_line_items_price: X
Also, I tried to use the formula they provided at Shopify API documentation where they mentioned that Gross Sales = product selling price x ordered quantity and I got the same result as sum of the total_line_items_price: X
Shopify Gross Sales at the financial report dashboard: Y
Shopify API sum of total_tax: Z Which is equal to the financial report taxes.
Please I need your help to calculate Gross Sales Correctly

Thank you

1

1 Answers

3
votes

You want to go through Transactions. Transactions include refunds and cancellations, whereas using totals from orders is not dynamic.

Shopify reports are and have always been a bit of a mess. Even today in 2020, a lot of merchants complain to me that the numbers do not add up, as there are numerous places for the uninformed to make mistakes. Takes for example editing orders. A lot of merchants use that. When line items are changes, draft orders are created and attached to orders, as a sequence. So if you are failing to follow those breadcrumbs, you may be double billing some items, or otherwise messing with totals.

So my advice to you is to use the numbers in the transactions, and see what that does for your reporting.