Foolproof way to detect which discounts were used on an order?

Hi there,

I’m trying to list all orders where a specific discount was used over a specific span of time.

Though the Order object has a discountCodes field that lists the discount codes applied to an order, it has a few issues:

  • It doesn’t distinguish between discount codes with the same name.
  • It only provides information about discount codes, not automatic discounts.

If the DiscountApplication object had a discount: Discount field that provided information about the specific discount that applied, it would be perfect.

Are there any known workarounds? The best alternative I’ve thought of is calculating expected discounts ourselves based on the order contents and comparing them to the order’s actual discounts.

Previous related discussions:

Thanks,
Tobe

1 Like

Found a relevant thread: Identifying the app/discount that applied a discount allocation?

Hey @tobebuilds, great question and thanks for sharing the relevant threads you have found.

Currently, the best workaround would be to use admin reports to create reports for specific discounts. This isn’t in the adminAPI currently (as you’ve found).

https://help.shopify.com/en/manual/reports-and-analytics/shopify-reports/report-types/reports-overview#shopifyql-editor