Discussing APIs and development related to customers, discounts, and order management.
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
Picture: 2
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`);