New Shopify Certification now available: Liquid Storefronts for Theme Developers

Add a "cartLine" target for Discount Functions

weotch
Shopify Partner
24 0 6

This is a feature request to add a "cartLine" type target to the Discount Function API.  Currently, we can only target `productVariant`.  This is problematic when a given variant exists on multiple lines, such as when using selling plans or custom line attributes, but your discount should only apply to certain qualifying lines.

 

For example, if you have a 10% on all subscriptions and you're applying that through Discount Functions, if a customer adds a variant with a selling plan to their cart as well as the same variant without a selling plan, we currently have no way to apply the discount to just the line with the selling plan. 

 

Yes, the customer does currently still get their intended discount.  However, the UX is confusing.  For example:

weotch_0-1693326389393.png

Note how the subscription discount is not being applied to the actual line with the selling plan.

Replies 2 (2)
Liam
Shopify Staff
Shopify Staff
1938 205 582

HI Weotch,

 

Thanks for describing this use case - I can totally see how having a "cartLine" type target in the Discount Function API would be helpful in situations where a variant exists on multiple lines. The situation where a variant has a selling plan and the same variant without a selling plan in the cart is a good example of this.

 

Currently, our API only supports productVariant as a target, which, as you pointed out, could lead to confusion in the UI when the discount isn't applied to the intended line. I'll forward your feedback to our product team! 

 

Thanks,

Liam | Developer Advocate @ 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

originmaster
Shopify Partner
28 1 13

There is a discussion here related to the problem https://github.com/Shopify/function-examples/discussions/199