How to calculate net sales

hmjeh1
Tourist
4 0 1

I calculated "Net sales" until now according to the following formula
"Net sales" = "Number(originalUnitPriceSet.shopMoney.amount) - discounts - taxLines",
And I was getting the wrong results

I searched and found that I was wrong about the formula
I saw the correct formula here

https://www.shopify.com/retail/net-sales 
that to calculate, I need the following fields
Net sales = Gross sales - Discounts - Sales returns - Allowances
I need help. How do I bring them into the API

Reply 1 (1)

ShopifyDevSup
Shopify Staff
1312 215 454

Hi @hmjeh1 

 

If you're working on a Plus store with an app that has access to the ShopifyQL orders dataset you can look up net sales totals there.

 

Otherwise, the GraphQL Order object holds multiple fields relating to it's corresponding transactions, discounts, etc.

 

Hope that helps.

Developer Support @ Shopify
- Was this reply helpful? Click Like to let us know!
- Was your question answered? Mark it as an Accepted Solution
- To learn more visit Shopify.dev or the Shopify Web Design and Development Blog