Discuss and resolve questions on Liquid, JavaScript, themes, sales channels, and site speed enhancements.
Hi everyone,
I'm trying to calculate the previous day's total gross sales in Shopify using the GraphQL orders query, aiming to match the totals from Shopify's Total Sales report or the shopifyqlQuery results.
The shopifyqlQuery provides accurate results but only after a full 24-hour delay. When querying gross_sales and discounts for October 1st on the morning of October 2nd, it returns an incomplete figure that continues to update until midnight on October 3rd.
I need to calculate a near-final total using the GraphQL API's fields like subtotalPriceSet, totalDiscountsSet, totalTaxSet, taxRate, billingCountry, etc. for each order. Despite testing formulas by region (e.g., handling tax-inclusive/exclusive pricing), I haven’t been able to replicate the report’s figures.
Example formula attempts:
- Sweden/Denmark (Tax-Inclusive): Gross Sales = (Subtotal Price - Total Discounts) / (1 + Tax Rate)
- UK (Tax-Exclusive):
- When Tax Rate > 0: Gross Sales = (Subtotal Price - Total Discounts) / (1 - Tax Rate)
- When Tax Rate = 0: Gross Sales = Subtotal Price - Total Discounts
- Canada/Others: Gross Sales = Subtotal Price - Total Discounts
Has anyone successfully matched these totals in near real-time? Any advice would be appreciated!
Thanks for your help,
Guillaume
We recently spoke with Zopi developers @Zopi about how dropshipping businesses can enha...
By JasonH Oct 23, 2024A big shout out to all of the merchants who participated in our AMA with 2H Media: Holi...
By Jacqui Oct 21, 2024We want to take a moment to celebrate the incredible ways you all engage with the Shopi...
By JasonH Oct 15, 2024