#oboxodo
1 messages · Page 1 of 1 (latest)
Hi, taking a look here
That is correct, you're unable to add line_items level discounts and it only supports a single coupon. In this case, you'd need to 'bundle' these discounts to create one coupon.
1/ I can share this feedback with our product team for future product considerations.
2/ Let me think about this for a bit. Off the top of my head, we typically recommend that you 'bundle' the discounts and just pass in one coupon.
1/ thanks. that'd be great.
2/ do you know if you guys have any sample code on "best practices" for bundling discounts?
By that, I meant that instead of applying three separate coupons for 5% off, you'd calculate that discount amount and add one coupon code on the entire checkout session.
yeah, OK. We'll consider that option.
It looks like that would be the only option currently, however, I will pass your feedback to the team. Can you speak more into why you'd like to pass coupons on each line_items? I'd like to make sure that I capture your business use case entirely when I share this feedback.
the reason to pass discounts to specific line items is because that discount would only qualify to that particular product.
I'm aware we could instead create a coupon with an applies_to value indicating the specific price objects it should apply. I don't recall right now why we didn't do it that way back then.
In any case, the fact that the session object supports only a single coupon means we wouldn't be able to apply two coupons, each applying to different line items in the checkout session. I think that might be a way more common need.
I'll give you a specific example:
Are these discounts for the same amount? Like 5% off both line_items 1 and line_items 2?
we have product A which costs $999. But if you include product B which costs $25, we'll give you a $300 discount on product A. At the same time, you could have a referral code which gives you a 25% discount but we can't include product B on that discount.
If so, if your business use case is to only apply these coupons to certain products only, then you could still use Checkout and add different prices to the same product. This will allow you to use applies_to: https://stripe.com/docs/payments/checkout/discounts#configure-a-coupon and use a single coupon.
In my example above, you'd pay 999 - 300 - 25% for product A, plus 25 for product B. Plus taxes.
I see
Yeah, we're considering the option of expanding each possible combination as a new price... damn it'll get messy, haha.
I'd highly encourage you to test this scenario on your end. It may be a heavy lift upfront to create these products and prices, but it also allows you to use Checkout that requires less coding.