Happening now | Office Hours: Customizing Your Theme With Moeed | Ask your questions now!

Unable to replicate analytics report through Graphiql - specifically Gross Sales for lineitem

Unable to replicate analytics report through Graphiql - specifically Gross Sales for lineitem

dhts
Shopify Partner
3 1 1

One of the standard reports within Shopify is "Total Sales by Order" which gives amongst other things for each line item:

Gross Sales - The price of the item excluding VAT and any Discounts

Net Sales - The price of the item excluding VAT but with discounts applied

Taxes - The VAT on the lineitem

 

Specifically where a discount of 10% has been applied to an order through a voucher code I can get the following through Graphiql:

Original Price including VAT (OriginalTotalSet)

The discount including VAT (AllocatedDiscount)

The VAT paid (Taxlines -> PriceSet)

 

So I can get Net Sales (The price of the item excluding VAT but with discounts applied) by:

OriginalTotalSet - AllocatedDiscount - Taxlines-PriceSet

 

But I can't work out how to get Gross Sales for that line item, ie the original price ex vat.

 

I did try simply dividing by unit price by the VAT rate of 20% but this is giving me rounding errors when compared with shopify as sometimes Shopify will round up and sometimes down depending on how it's treating the VAT on that line. I really need Shopify's view of the ex-tax rate for the lineitem.

 

It's for accounting purposes so needs to be accurate to the nearest penny.

 

Any help appreciated.

 

 

Reply 1 (1)

tobebuilds
Shopify Partner
588 42 159

You might consider asking this on Shopify's developer community forum, since it's an API question:

 

https://community.shopify.dev/

 

If you make a post there, please link it here. I'm also interested in hopefully hearing Shopify potentially explain how they decide whether to round prices up or down.

Founder, Regios Discounts app (4.8 stars, 92 reviews, Built for Shopify)
- Custom discounts made simple
- "Just about any discount you'll ever need"
- Built by an ex-Google software engineer
- Often imitated, never duplicated