Out now! Check out the Poll results: Do you have a Shopify store?
Our Partner & Developer boards on the community are moving to a brand new home: the .dev community forums! While you can still access past discussions here, for all your future app and storefront building questions, head over to the new forums.

Discount code is not applying in cart

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
44 2 14

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`);