Order with automatic discount

Is it possible to query all the orders that include specific automatic discount?

As in the orders query docs (orders - GraphQL Admin (shopify.dev)) you can only query by discount_code which not relevant to automatic discounts.

And even if you query all orders, it’s impossible to know which automatic discount affect which order as there is no discount id attached to the order, and you can only see how much discount applied and the target (shipping/line item)

There is any other way to accomplish this query? did I miss something in the docs?

Hey Ofirelarat,

Heddy from Gameball: Loyalty Program & VIP here!

Currently, Shopify’s GraphQL API doesn’t allow you to directly query orders based on automatic discounts, as no discount ID is attached to the order. You can only see the discount applied and its target (shipping or line item). To work around this, you may need to manually cross-reference the applied discount amounts with your set automatic discount values or track them through a custom app that logs those discounts when they are applied.

1 Like