How can I apply a custom script discount to non-free items in the cart?

Shopify Partner
12 0 4

Hi there!

I have a script that is adding discount on line item based on the threshold so e.g the threshold is $15 and the discount is $5 now what happens is whenever threshold reaches it adds the $5 discount on first line item. 


Now what I want is if user used a coupon code e.g there is a coupon code that if user used he will get product X as free. 

Now what happens is if I add Product X and Y in the cart custom script applied the $5 discount on the first product X and then when we apply coupon code it mark the product X as free. Now the price of Product Y remains same what we want is that if any product mark free by coupon code then custom script discount should apply on any other item in cart so at the end customer can get both discounts. 

Any help would be appreciated, Thanks 

Replies 0 (0)