A space to discuss GraphQL queries, mutations, troubleshooting, throttling, and best practices.
Hello, has anyone figured out a way to get the exact numbers that are displayed on the Sales by Product using the Orders API?
Im using the orders endpoint with the parameters status=any, limit=250,
since_id={last} - which gets the last order id on the page to paginate through all the results, and the created_at_min/max for the date.
From the Sales by Product report it shows 139 for the product OP but the api call only brings back 138. I contacted support on how the net quantity is calculated which is "
Net quantity equates to number of sold items - number of returned items."
Any tips here to get the same results as the report from Shopify admin?
Honestly, it is possible but very time consuming and fraught with peril based exceptions and nuance. We have created a reporting app and we spent the better part of 6 months insuring data accuracy.
Hi Global!
I thought I was the only one with this issue. I'm also pulling the orders through API and comparing it with the Total Sales in the Analytics page. There are always discrepancies with the total as well as per day.
That’s because you aren’t comparing apples to apples. If you want to compare something to the Admin Order API, you would use the orders screen or the export csv. If you want to compare to the analytics page, you need to use the Sales model in the Shopify QL API
Thank you for that! I will try using Shopify QL API instead.
Hi CloudlabSam!
Already tried pulling orders from Shopify QL API but I still get discrepancies between the sales over time report in the Analytics page if I compare it per day. However, if I compare the total, I usually get a 1% variance.
The closest I got to the total sales in the Analytics page was by using SubTotalPrice .
Appreciate your help!
{
orders (first:100,
query:"created_at:>2020-07-25",
) {
edges {
node {
id
createdAt
taxesIncluded
currentSubtotalPriceSet {
shopMoney {
amount
}
}
}
}
}
}
Hi there - the query you included is not actually a Shopify QL query, it is just querying the orders model via GraphQL. So this would be comparable to records found on the Orders admin screen.
To compare to sales you will need to use the Shopify QL API. You can read more about that here - https://shopify.engineering/shopify-commerce-data-querying-language-shopifyql.
Thanks CloudlabSam!
I was able to get the sales data I need using the Shopify QL API!