Our Partner & Developer boards on the community are moving to a brand new home: the .dev community forums! While you can still access past discussions here, for all your future app and storefront building questions, head over to the new forums.

GraphQL - lineItem Discount Codes, Discount Values by Item

GraphQL - lineItem Discount Codes, Discount Values by Item

edwinv
Tourist
4 0 3

How do I query for the discount code and discount value (e.g. 10%, 20%, $5) discounted from each lineItem in orders?

With the following query I am able to get the actual final amount discounted on a line, but not the discount value - and I get the discount code applied to the entire order, but I need to know by lineItem (in case there is some mixing and matching of discounts).

 

 

query orders_discounts($id:String){
    orders(first:1, query:$id ){
        nodes{
            discountCodes
            lineItems(first:20){
                nodes{
                    quantity
                    originalUnitPrice
                    discountAllocations{
                        allocatedAmount{
                            amount
                        }
                    }
                    
                }
            }
        }
    }
}

 

 Would this data be stored within discountAllocation.discountApplication? If so, how does one query it?

Thanks in advance!

Reply 1 (1)

mleive
Shopify Partner
1 0 0

Hi everyone, is there an answer to this question by now? I also have the requirement of how much the discount amount is per line and discount code. 

It is possible to apply different discounts, some of which apply to the entire order and others only to specific items.

Thanks