Create and apply coupon codes
A Coupon Code is a code that a customer enters to get a discount. The code does not hold the discount itself. It links to a Pricing Rule, and the pricing rule defines who gets which discount on which items.
Coupon Code is part of ERPNext. Customers enter codes at the webshop checkout. Your staff can also enter a code in the Coupon Code field of a Quotation, Sales Order, Sales Invoice, or POS Invoice.
Prerequisites
- For the webshop: Show Apply Coupon Code selected in Webshop Settings, and the items published with prices.
Create a coupon-based pricing rule
- Open the Pricing Rule list and create a new Pricing Rule for selling.
- Set the eligible items or item groups, the conditions, the quantity or amount limits, and the validity.
- Choose a price discount or a product discount.
- Select Coupon Code Based.
- Save.
TIP
Avoid coupon rules that overlap, unless you have tested which rule wins.
Create the coupon code
- Open the Coupon Code list and create a new Coupon Code.
- Enter the Coupon Name.
- Select the Coupon Type:
- Promotional: a reusable code. ERPNext creates the code from the coupon name: the name without digits, cut to 8 characters, in capitals.
- Gift Card: a random code for one customer. Select the Customer. ERPNext sets Maximum Use to 1.
- Select the Pricing Rule. It must be enabled.
- Set Valid From and Valid Up To.
- For a promotional code, set Maximum Use to cap the total number of uses. Leave it empty for no limit.
- Optional: write a Coupon Description for your campaign text.
- Save. Check the Coupon Code that ERPNext created before you send it to customers.
How usage is counted
| Field | What it controls |
|---|---|
| Coupon Type | Promotional (reusable) or Gift Card (one customer, one use) |
| Pricing Rule | The discount and its conditions |
| Valid From, Valid Up To | The period in which the code works |
| Maximum Use | The total number of uses allowed |
| Used | The number of uses so far. Read-only |
Each time you submit a Sales Order, Sales Invoice, or POS Invoice with the code, Used goes up by one. Cancelling the document lowers it again.
Apply a coupon code
In the webshop, the customer enters the code in the coupon field of the cart. ERPNext checks the code and its pricing rule, and recalculates the prices of the eligible items.
In the Desk, enter the code in the Coupon Code field of the Quotation, Sales Order, Sales Invoice, or POS Invoice.
Test before launch
Test at least:
- An eligible item and quantity, and an item that is not eligible.
- Dates before, during, and after the validity period.
- The Maximum Use limit.
- A guest and a signed-in customer, if your webshop allows both.
- Another Promotional Scheme or discount that could overlap.
Troubleshooting
| Problem | What to check |
|---|---|
| The coupon field is missing in the webshop | Select Show Apply Coupon Code in Webshop Settings |
| The code is rejected | The spelling, the validity dates, Maximum Use, and the linked pricing rule |
| The code gives no discount | Whether the cart meets every condition of the pricing rule |
| The wrong discount applies | Other pricing rules that overlap, and their priority |
| "Coupon used are ... Allowed quantity is exhausted" | Used has reached Maximum Use. Raise the limit or create a new code |
| "Pricing Rule ... is disabled" | Enable the pricing rule, or select another one |
| "Please select the customer." | A Gift Card coupon needs a Customer |