How can i get total sales through API, same as displaying in analytics screen in Store?
You should be able to get this info by querying Orders:
EG:
query GetTotalSales($startDate: DateTime, $endDate: DateTime) {
orders(first: 100, query: "created_at:>=$startDate created_at:<=$endDate") {
edges {
node {
totalPriceSet {
shopMoney {
amount
currencyCode
}
}
financialStatus
}
}
}
}
I think problem here is the limitation of how many we can get, if we wanted to get sales over time it would be a lot of queries to get all orders for example. It’s a real shame the ShopifyQL endpoint got deprecated
Isn’t it currentTotalPriceSet? Because we need to consider returns as well right?
Correct, for accounting for returns too then currentTotalPriceSet would be what you’d use.
You can’t access it via API but would the new ShopifyQL query editor help at all?
The editor isnt any good if we need this data in our apps