Discount code is not applying in cart

dev051
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)
Starshards
Shopify Partner
24 1 11

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

Use this

baseURL/discount/DISCOUNT_CODE?redirect=/checkout

instead of this

/checkout?discount=DISCOUNT_CODE

 

Something like that:

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