Use API to determine if customer used automatic "Buy X Get Y" discount

Use API to determine if customer used automatic "Buy X Get Y" discount

jfkScollar
Shopify Partner
19 0 2

We are trying to determine via the API if a given customer has used a "Buy X Get Y" automatic discount. I have review the various APIs related to discounts and I do not see a way to do that. 

 

I there an API to do this?

 

Thanks,

John

Replies 3 (3)

JustinW
Shopify Partner
15 0 4

You can check discounts used from the get Order call.

Helping customers integrate their E-Commerce and Salesforce data

ShopifyDevSup
Shopify Staff
1453 238 511

Hi @jfkScollar  👋

 

@JustinW is exactly right, the `Order` resource is connected to the `DiscountApplication` interface that includes the `AutomaticDiscountApplication` object.  It would look something like this:

 

{   
    customer(id:"gid://shopify/Customer/9876543210"){
        orders (first:20) {
            nodes {
                id
                discountApplications (first:3){
                    nodes {
                        ... on AutomaticDiscountApplication {
                            title
                        }
                    }
                }
            }
        }
    }
}

 

 

Hope that helps!

 


 

Developer Support @ Shopify
- Was this reply helpful? Click Like to let us know!
- Was your question answered? Mark it as an Accepted Solution
- To learn more visit Shopify.dev or the Shopify Web Design and Development Blog

jfkScollar
Shopify Partner
19 0 2

Thank you for your replies with suggestions. I see I can get it from the order API call and the 

discount_applications key in the response. I was hoping to use a call to a "discount" API that would then list the orders and/or customers who have used it in its response.