Discount code is not applying in cart

Discount code is not applying in cart

Shopify Partner
1 0 0

Discount code applying in cart if the cart token start with c1- (picture: 1) otherwise not (pcture: 2). What is the reason for this? and How to  set cart token with prefix "c1-"? 


Picture: 1

Screenshot 2023-07-19 111207.png


Picture: 2

Screenshot 2023-07-19 111349.png





Reply 1 (1)

Shopify Partner
44 2 14

The issue is that you're using a deprecated method of applying a discount code to your checkout.

Use this


instead of this



Something like that:

let baseUrl = window.location.protocol + "//" + window.location.hostname;
checkout.attr('href', `${baseUrl}/discount/${discountCode}?redirect=/checkout`);