Have your say in Community Polls: What was/is your greatest motivation to start your own business?
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.

Neither discountedTotalSet nor totalDiscountSet include the line item's discount

Solved

Neither discountedTotalSet nor totalDiscountSet include the line item's discount

minsko
Shopify Partner
28 3 6

When querying the line items for an order, I noticed that the discountedTotalSet (which should be the original price - discount) shows the original value and does not apply the discount. https://shopify.dev/docs/api/admin-graphql/2023-10/objects/lineitem#field-lineitem-discountedtotalse... 

The discount can be seen in the discountAllocations but not in the totalDiscountSet nor the discountedTotalSet .

 

I have attached a redacted query and the results: (ignore the .csv as they are really .txt).

 

Accepted Solution (1)

ShopifyDevSup
Shopify Staff
1453 238 524

This is an accepted solution.

Hey @minsko and @wilson_02

This is a great question. I tested to replicate here, and it is working as expected. 

The discountedTotalSet field must be explicitly set using draft orders, Shopify scripts, or the API. It's recommended instead to use discountAllocations

Our GraphQL documentation is not as clear on this field as we are on REST, so I'll get that feedback over to our team. 

 

Hope that helps! 

 

- Kyle G. 

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

View solution in original post

Replies 4 (4)

wilson_02
Shopify Partner
1 0 0

Are you open for conversation??

wilson
minsko
Shopify Partner
28 3 6

Yes. To clarify, on this issue, I have applied a product discount, not an order discount.

ShopifyDevSup
Shopify Staff
1453 238 524

This is an accepted solution.

Hey @minsko and @wilson_02

This is a great question. I tested to replicate here, and it is working as expected. 

The discountedTotalSet field must be explicitly set using draft orders, Shopify scripts, or the API. It's recommended instead to use discountAllocations

Our GraphQL documentation is not as clear on this field as we are on REST, so I'll get that feedback over to our team. 

 

Hope that helps! 

 

- Kyle G. 

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

minsko
Shopify Partner
28 3 6
Thank you for that explanation.

Regards,

Matt Insko