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.

BuyXGetY Line Item Discount Allocation

Solved

BuyXGetY Line Item Discount Allocation

buywithfin
Tourist
7 0 5

Hi,

 

Is there a way to understand via the GraphQL admin API which line item on an order is the "X" when a BuyXGetY discount has been applied to an order?  While trying to develop a self-service returns app, I am trying to identify which line items on an order are affected by a BuyXGetY discount.  It is (partially) clear which item is the "Y" line item (it has been allocated a discount) but it is unclear which item is the "X".

 

I thought maybe the "index" field under the DiscountAllocation key would provide some insight but it doesn't appear to.

 

The reason I am trying to identify the "X" is that I want to force customers to return item "Y" when they choose to return item "X".


I hope that makes sense.  Please let me know if I can add more clarification.


Thanks!

Accepted Solution (1)

jon551
Shopify Staff
28 7 5

This is an accepted solution.

Hi Buywithfin,

 

There is not currently a direct way with the GraphQL API to identify which was the 'X' item in a BuyXGetY discount so we've submitted a suggestion about that on your behalf.

 

Thanks and hope you have a great day,

Jon551 | API Support @ Shopify
 - Was my reply helpful? Click Like to let me 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 2 (2)

jon551
Shopify Staff
28 7 5

This is an accepted solution.

Hi Buywithfin,

 

There is not currently a direct way with the GraphQL API to identify which was the 'X' item in a BuyXGetY discount so we've submitted a suggestion about that on your behalf.

 

Thanks and hope you have a great day,

Jon551 | API Support @ Shopify
 - Was my reply helpful? Click Like to let me 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

buywithfin
Tourist
7 0 5

Thanks Jon!