Discount Function - Getting line level discounts

Hi,

In Shopify Discount Functions, how do I get the existing line level discounts already applied to the cart line item? I see that we can get totalAmount and that is same as subtotalAmount?

Regards,
Gaurav Agarwal

Hi! You don’t get existing line level discounts as part of your function input. All the discount functions run independently, without knowledge of each other, and then the platform decides which discounts should apply to the cart. Discounts or fees that would be added on top of discounts are not yet added to the cart you get as input, which also explains why the subtotalAmount would often be the same as totalAmount.