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!

Replies 0 (0)