How to calculate Average Order Value using the Admin API

doabledanny
Shopify Partner
12 0 6

Using the GraphQL admin API, I need to calculate the Average Order Value using the same calculation defined in Shopify's reports documentation:

 

Equates to gross sales (excluding adjustments) - discounts (excluding adjustments) / number of orders. Adjustments include all edits, exchanges, or returns that are made to an order after it's initially created.

I've tried querying order.subtotalPriceSet, but that changes whenever the order is edited (e.g. if I add another line item to the order). How to I get the original subtotal price and original total discounts applied so that I can calculate the Average Order Value the same way that Shopify does?

Replies 0 (0)