I have a question that we calculate total sales from order api but the value from the api is different from the dashboard of shopify which is in the analytics section so how what we do that the value is similar like analytics.
How i use order api?
I calculate total order and sum of all order in the key of total_price through which we find gross sales but we didn't find the total sales or net sales so how can i find that value.
Please look into this matter it's urgent.
Hey @deepanshu-mobo ,
From the Shopify documentation (https://help.shopify.com/en/manual/reports-and-analytics/shopify-reports/report-types/sales-report) we can see that Total Sales in our analytic reports is calculated as follows:
total sales = gross sales - discounts - returns + taxes + shipping charges. Where gross sales = product price x quantity (before taxes, shipping, discounts, and returns)
The 'total_price' field from the Orders API does take into account gross sales - discounts + taxes + shipping charges, but not take into account returns. So you will need to calculate how much money was refunded by your store separately. Once you know that information, you should be able to calculate the total sales for your store accurately.
Also one thing to point out: sales of Gift Cards are not included in to the Shopify "Total Sales" analytics report. So using the Order API you should skip any line items where you sell Gift Cards in your calculation.
Hassain | Developer Support Specialist @ Shopify
- Was my reply helpful? Click Like to let me know!
- Was your question answered? Click Accept as Solution