What's your biggest current challenge? Have your say in Community Polls along the right column.

How to calculate total sales using shopify api

How to calculate total sales using shopify api

team_supercrew
Visitor
2 0 2

I am building a software which brings data from shopify (and other channels, but they are not relevant here) and visualises it.

 

I am using shopify API to fetch orders data. I need to calculate "Total Sales" to display in my dashboard, and it should match the "Total Sales" value in the shopify analytics dashboard.

 

Here a few things I am trying:
1.⁠ ⁠"total_price" in orders api gives an idea of the value of the order when the order was created, but it doesn't have the edits which might have been made to the order (for ex, if other items were added, removed, etc.)
2.⁠ ⁠"current_total_price" in orders api is the net amount after the edits and returns, but shopify seems to subtract returns on the day they are created, not on the day the order was created. Using "current_total_price" will give a different "Total Sales" value than shopify.

 

Only option I see here is to use the transactions table, and somehow try to make sense of order edits and then calculate the final amounts. But I am also confused if the order edits are reflected on the day they are created, or on the day the order is created. For ex: If I edit an order and change the total price from ₹500 to ₹1,000, will shopify add ₹500 of sales on the day the order was created, or on the day the edit was made?

 

I am confused here. Can someone help me out?

Replies 0 (0)