Coupons
Coupons give buyers a discount at the Core Commerce checkout. A code takes a percentage or a fixed amount off, for the first payment or for every payment, and you can limit it by dates, uses, products, plans and order size.
Every discount is calculated on the server and checked again before a license is issued, so a buyer can’t change the price by editing the page. A code is counted as used only after the payment is confirmed.
Turn on Coupons
- Go to Core Forms > Modules.
- Find Coupons in the Core Commerce group and click Turn on. This also turns on Licensing and Storefront if it’s off.
- Open Core Commerce > Coupons, or use the Manage coupons link on the module card.
Create a coupon
- Go to Core Commerce > Coupons and click Add coupon.
- Fill in the fields below. Codes aren’t case-sensitive, and dates use UTC.
- Click Save coupon.
| Field | What it does |
|---|---|
| Code | The code buyers type. Letters, numbers, hyphens and underscores, up to 64 characters. It’s saved in capitals and must be unique. |
| Internal note | A reminder for you. It shows under the code in the list, never to buyers. |
| Type | Percentage or Fixed amount. |
| Amount | The discount. Above 0, and no more than 100 for a percentage. Enter fixed amounts in normal units, such as 10.00. |
| Currency for fixed amounts | Required for a fixed amount. A fixed coupon works only in this currency. Percentage coupons work in every currency. |
| Duration | First payment only, or Every payment, including automatic renewals. |
| Applies to | New purchases, Renewals, or Purchases and renewals. |
| Product IDs | Limit the code to these products. Separate IDs with commas or spaces. Leave empty for every product. |
| Plan IDs | Limit the code to these plans. Leave empty for every plan. |
| Starts and Ends | The code is refused before the start and after the end. Leave either empty for no limit. |
| Total uses | How many paid orders can use the code. 0 means unlimited. |
| Uses per customer | How many times one buyer email can use it. 0 means unlimited. |
| Minimum order | The order subtotal the code needs. Leave empty for no minimum. |
| Status | Active or Archived. Archived codes are refused. |
The list shows each code’s discount, such as “20% off the first payment”, what it applies to, how often it’s been used, its dates and its status.
Share a coupon link
Add coupon= to a checkout link and the code is applied when the page opens:
https://example.com/core-checkout/?cf_product=my-plugin&cf_plan=personal&coupon=LAUNCH20
- It works on the shared checkout page and on a checkout pinned to one product and plan.
cf_coupon=works the same way.- The buy button, price and product blocks don’t take a coupon setting. Use a link like the one above instead.
What buyers see
With only Coupons on, the checkout shows an Add a coupon code link. It opens a field with an Apply button. With the Tax and VAT module on too, the checkout shows a Tax and coupon box with an Update total button instead.
The order summary then shows the subtotal, a Discount (LAUNCH20) row and the new total.
A refused code shows one of these messages:
| Message | Why |
|---|---|
| That coupon code is not valid. | No coupon has this code. |
| This coupon is not active. | It’s archived. |
| This coupon is not valid yet. | Its start date hasn’t arrived. |
| This coupon has expired. | Its end date has passed. |
| This coupon has been fully redeemed. | It reached its total uses. |
| This coupon cannot be used for renewals. | It’s for new purchases only. |
| This coupon cannot be used for this purchase. | It’s for renewals only, or the order is an upgrade. |
| You have already used this coupon. | This buyer email reached its uses per customer. |
| This coupon does not apply to the selected product. | No item in the order matches its product or plan IDs. |
| This coupon needs an order of at least USD 50.00. | The subtotal is below its minimum order. |
| This coupon is not valid in this currency. | A fixed coupon was used in another currency. |
How the discount is calculated
- Percentage: the percentage of every order item that matches the coupon’s products and plans. 20% of 99.00 is 19.80.
- Fixed: the amount, never more than the matching items. A 150.00 coupon on a 99.00 order takes 99.00.
- Checkout questions: paid add-ons from checkout questions count as part of the product, so a percentage coupon discounts them too.
- One code per order. Buyers can’t combine coupons.
- Tax comes after the discount. See Tax and VAT for rates. On a 100.00 order with 20% off and 19% VAT, the buyer pays 80.00 plus 15.20 VAT, so 95.20.
Renewals, upgrades and payment methods
- Automatic renewals: with Automatic Renewals on, a code set to Every payment, including automatic renewals lowers every renewal charge too. A First payment only code lowers only the first charge.
- Upgrades: coupons never apply to license upgrades, and the upgrade checkout has no coupon field.
- FluentCart: FluentCart prices orders itself, so the checkout refuses it when a coupon changes the price: “Coupons and tax are not available with this payment method. Choose another method.”
Coupons on Core Forms checkout forms
Generated checkout forms and your own forms use the Fulfill License Purchase action. Its Coupon code setting defaults to [coupon], which reads a field named coupon.
The generated sample checkout forms don’t include that field. To accept codes on one, add a text field named coupon in the form editor. A form without the field simply has no coupon.
Uses, refunds and retiring a code
- A use is counted once per paid order. A free order from a 100% coupon counts too.
- Use limits are checked when the checkout prices the order, and the use is counted after payment. Two buyers paying at the same moment could both take the last use.
- Refunds don’t give a use back. The order keeps its discount and coupon code, and invoices still show them.
- There’s no delete button. Set the status to Archived to retire a code while keeping its history.
Turn Coupons off
While any coupon is active, the Modules screen asks before turning Coupons off. Turning it off deletes nothing:
- The Coupons tab and the checkout’s coupon field disappear.
?coupon=links are ignored without an error.- Past orders keep their discounts, and turning the module back on restores every code.
For developers
There’s no REST route, WP-CLI command or ability for coupons. Order responses from GET /wp-json/core-forms/v1/commerce/orders include discount_minor and coupon_code.
cf_commerce_quotefilters the price of every purchase. Coupons run at priority 10, tax at 20.cf_commerce_order_paidfires with the order ID, the order kind, the license IDs and the submission once an order is paid.cf_checkout_quote_fieldsprints fields in the checkout’s coupon and tax box.