Docs
Scope
How to pass coupon id on the checkout URL?
How to pass coupon id on the checkout URL?
The following sections cover how to pass a coupon ID in the checkout URL and how to create a checkout URL with a coupon applied.
You can include a coupon code in the checkout script so that it is automatically applied. It can be done similarly to the example mentioned in the "Add-on customizations" section in this document. The script code to include coupons is mentioned below.
var cbInstance = Chargebee.getInstance();
var link = document.querySelectorAll("[data-cb-type=checkout]")[0];
var product = cbInstance.getProduct(link);
product.addCoupon("COUPON NAME");
Was this article helpful?