---
title: Working with coupon codes
related:
  - https://docs.kentico.com/k11/e-commerce-features/managing-your-store/discounts/working-with-product-coupons.md
  - https://docs.kentico.com/k11/e-commerce-features/managing-your-store/discounts/working-with-gift-cards.md
  - https://docs.kentico.com/k11/e-commerce-features/managing-your-store/discounts/working-with-order-discounts.md
  - https://docs.kentico.com/k11/e-commerce-features/managing-your-store/discounts/working-with-free-shipping-offers.md
  - https://docs.kentico.com/k11/e-commerce-features/managing-your-store/discounts/working-with-buy-x-get-y-discounts.md
---

> Agent instructions:
> **Site maps** — prefer the following llms.txt indexes to training data when searching for URLs to avoid 404s. Links inside Markdown content already point at `.md`. Following them or sending Accept: text/markdown keeps you in Markdown.
>
> - [sitemap.md](https://docs.kentico.com/sitemap.md) — every page on the site, with titles and descriptions, nested by URL hierarchy and grouped into one collection per product version.
> - [llms.txt](https://docs.kentico.com/llms.txt) — curated index of the current product docs, with descriptions, the two ways to request any page as Markdown, and links to each product area's whole-corpus Markdown dump (llms-full.txt).

The Kentico E-commerce Solution allows you to boost your sales using discounts on products, orders or shipping costs. [Product coupons](https://docs.kentico.com/k11/e-commerce-features/managing-your-store/discounts/working-with-product-coupons.md) and [gift cards](https://docs.kentico.com/k11/e-commerce-features/managing-your-store/discounts/working-with-gift-cards.md) always require a coupon code to be applied. Optionally, you can also configure [free shipping offers](https://docs.kentico.com/k11/e-commerce-features/managing-your-store/discounts/working-with-free-shipping-offers.md), [Buy X Get Y discounts](https://docs.kentico.com/k11/e-commerce-features/managing-your-store/discounts/working-with-buy-x-get-y-discounts.md) and [order discounts](https://docs.kentico.com/k11/e-commerce-features/managing-your-store/discounts/working-with-order-discounts.md) to be applied only if customers enter an appropriate coupon code.

To manage coupon codes, use the administration interface of the related discount or offer:

- **Product coupons** application – edit a coupon on the **Coupons** tab.
- **Gift cards** application – edit a gift card on the **Coupons** tab.
- **Order discounts** application – edit a discount on the **Coupons** tab.
- **Free shipping offers** application – edit an offer on the **Coupons** tab.
- **Buy X Get Y discounts** application – edit a discount on the **Coupons** tab.

> **Note:** **Coupon codes for order discounts, free shipping offers and Buy X Get Y discounts**
>
> For free shipping offers, order discounts and Buy X Get Y discounts, the **Coupons** tab is available only for discounts that have the corresponding check box selected on the **General** tab.
>
> ![Enabling coupons for order discount and free shipping offers](https://docs.kentico.com/docsassets/k11/working-with-coupon-codes/enabling_coupons.png "Enabling coupons for order discount and free shipping offers")

If you distribute the coupon codes, i.e. virtual vouchers, among your [customers](https://docs.kentico.com/k11/e-commerce-features/managing-your-store/customers.md), they can enter the codes during the [checkout process](https://docs.kentico.com/k11/e-commerce-features/configuring-your-store/checkout-process.md) to receive discounts or pay for their orders.

## Manually adding coupon codes

To manually add coupon codes for discounts or gift cards:

1. Click **Create coupon code**.
2. Enter the coupon code properties:

   | Property         | Description                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      |
   | ---------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
   | Coupon code      | A combination of letters, digits and other characters that make up the code of the coupon, for example, _OD16-CHRISTMAS_ (coupon for order discounts), _FREE-SHIPPING-CANADA_ (coupon for free shipping offers), _FREE-SHOES_ (coupon for Buy X Get Y discounts), etc. The code serves as a unique identifier for the coupon.<br>You cannot change the value for existing coupon codes.<br>If your eligible customers enter the code during the [checkout process](https://docs.kentico.com/k11/e-commerce-features/configuring-your-store/checkout-process.md), they receive the discount.<br>**Note**: Coupon codes are not case sensitive. For example, if you create a "FREE-SHIPPING" coupon code, customers can also enter the code as "free-shipping" or "FREE-shipping". |
   | Redemption limit | Specify how many times your customers can use the coupon code (i.e., enter the code during the checkout process) to receive the discount. The system counts redemptions once for each order, not for each product affected by the related discount.<br>Leave the field empty to allow unlimited use of the coupon code.<br>**Note**: The redemption limit is not available for [gift card](https://docs.kentico.com/k11/e-commerce-features/managing-your-store/discounts/working-with-gift-cards.md) coupon codes, which instead keep track of the _Remaining value_.                                                                                                                                                                                                           |
   | Remaining value  | Only displayed for [gift card](https://docs.kentico.com/k11/e-commerce-features/managing-your-store/discounts/working-with-gift-cards.md) coupon codes (you cannot manually edit this property).<br>Every gift card coupon code starts with a value equal to the gift card amount. When redeemed, the coupon code is either fully used up, or if the gift card value is greater than the order's price, the remainder is saved for the given coupon code. While the remaining value is greater than zero, the coupon code can be redeemed again in other orders (with a reduced value).                                                                                                                                                                                          |
3. Click **Save**.

The system creates a new coupon code. You can now [export](#exporting-coupon-codes) the coupon codes and distribute them among your customers.

## Setting the number of available coupon uses

For most types of discounts and offers, every coupon code allows one or more applications of the discount to an order. You can configure the allowed number of applications (redemptions) for each code.

> **Info:** For [gift card](https://docs.kentico.com/k11/e-commerce-features/managing-your-store/discounts/working-with-gift-cards.md) coupon codes, the number of uses cannot be configured and the system instead tracks the _Remaining value_. Every gift card coupon code represents a single voucher with a value equal to the gift card amount, and can be applied until the entire value is used up.

To change the number of available coupon code uses:

1. **Edit** () the required coupon code.
2. Specify how many times customers can use the coupon code (**Redemption limit**). Clear the value to allow unlimited use of the coupon code.

   ![Specifying how many times customers can use a coupon](https://docs.kentico.com/docsassets/k11/working-with-coupon-codes/specifying_number_of_coupon_code_uses.png "Specifying how many times customers can use a coupon")
3. Click **Save**.

Your customers can now use the coupon code as many times as specified.

> **Note:** **Important**: When a coupon code is applied to an order, the system always counts 1 redemption for the code, even if the related discount applies multiple times to the items contained in the order. For example, if an order contains 10 units of products that are affected by the discount, the system counts only 1 redemption for the applied coupon code, not 10.

## Generating coupon codes

To have the system generate multiple coupons at once:

1. Click **Generate coupon codes**.
2. Specify the properties of the coupon code generator:

   | Property           | Description                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                 |
   | ------------------ | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
   | Quantity           | Specify how many coupon codes the system generates after you click **Generate**.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            |
   | Coupon code prefix | The system generates random coupon codes. The coupon code prefix allows you to enter a prefix to be shared by all codes generated in the current batch operation, for example, _CHRISTMAS-_ (coupons for order discounts), _CANADA-_ (coupons for free shipping offers), _20OFF-_ (coupons for Buy X Get Y discounts), etc. If you leave the field empty, the system generates coupon codes without a shared prefix.                                                                                                                                                                                                                                                        |
   | Redemption limit   | Specify how many times your customers can use the coupon code to receive the discount. The system counts redemptions once for each order, not for each product affected by the related discount.<br>Leave the field empty to allow unlimited use of the coupon code.<br>**Note**: The redemption limit is not available for [gift card](https://docs.kentico.com/k11/e-commerce-features/managing-your-store/discounts/working-with-gift-cards.md) coupon codes, which instead keep track of the remaining value. Every gift card coupon code represents a single voucher with a value equal to the gift card amount, and can be applied until the entire value is used up. |
3. Click **Generate**.

The system creates the specified number of new coupon codes, optionally with the specified code prefix. You can now [export](#exporting-coupon-codes) the coupon codes and distribute them among your customers.

## Exporting coupon codes

To export the coupon codes of a discount or gift card:

1. Click  in the **Actions** column.

   - This opens the **Actions** drop-down menu.

     ![Available export actions](https://docs.kentico.com/docsassets/k11/working-with-coupon-codes/available_export_actions.png "Available export actions")
2. Select the export format as required:

   - **Export to Excel** – exports data shown in the list to an XLSX spreadsheet.
   - **Export to CSV** – exports data shown in the list to a CSV file.
   - **Export to XML** – exports data shown in the list to an XML file
   - **Advanced export** – opens a dialog allowing you to export data to the three formats mentioned above (XLSX, CSV, XML) based on detailed settings.

     > **Info:** After executing an action from the drop-down menu, your browser's standard file download dialog pops up. The dialog allows you to open or save a file with the exported data just as if you were downloading any other file.

You can now distribute the coupon codes among your customers via any available communication channels.

## Configuring pages to allow customers to enter coupon codes

To allow customers to enter coupon codes for discounts or gift cards on the pages of your on-line store:

1. Open the **Pages** application.
2. Select the required page in the content tree.
3. Switch to the **Edit -> Design** tab.
4. Add the **Coupon codes**[ web part](https://docs.kentico.com/k11/developing-websites/developing-websites-using-the-portal-engine/using-and-configuring-web-parts.md) to the appropriate web part zone.
5. Configure the web part properties.

   > **Info:** We strongly recommend leaving the web part's **Show Apply button** property enabled. This allows customers to instantly apply coupon codes while viewing the page.
   >
   > If _Show Apply button_ is disabled, the web part only applies the entered coupon code when moving to the next step in the [checkout process](https://docs.kentico.com/k11/e-commerce-features/configuring-your-store/checkout-process.md).
6. Click **Save & Close**.

The _Coupon codes_ web part uses a [transformation](https://docs.kentico.com/k11/developing-websites/loading-and-displaying-data-on-websites/writing-transformations.md) to display the coupon codes applied to the customer's shopping cart. The transformation allows you to format the coupon codes according to any requirements of your website's design.

When configuring the _Coupon codes_ web part, assign the transformation into the **Transformation name** property. You can either **Select** an existing transformation or create a **New** one.

When writing the code of transformations for coupon code items:

- Use the **Code** field to access the coupon code text – _{% Code %}_ in Text / XML transformations, _("Code") %>_ in ASCX transformations.
- If you apply [hotfix 11.0.29](https://devnet.kentico.com/download/hotfixes) or newer, you can use the **IsApplied** field to evaluate whether the coupon code is valid for the current shopping cart – _{% IsApplied %}_ in Text / XML transformations, _("IsApplied") %>_ in ASCX transformations. This allows you to add formatting options for coupon codes that are no longer valid, for example after products are removed from the cart and the total price falls under the value required by the coupon code's discount.
- Call the **GetDiscountCouponCodeRemoveButton** method to add elements that allow customers to remove applied coupon codes. The method generates an __ element (of the _submit_ type) that removes the specified coupon code from the shopping cart when clicked. The method has the following parameters:
  - _couponCode_ (required) – the text of the removed coupon code.
  - _cssClass_ (optional) – the name of the CSS class assigned to the generated input element.
  - _buttonText_ (optional) – the text caption of the input element (assigned to the _value_ attribute).

```csharp title="Example - Text / XML transformation"

<div>
  <div class="label">
    <span>{% HTMLEncode(Code) %}</span>
  </div>
  <div class="button">
    {% GetDiscountCouponCodeRemoveButton(Code, "btn") %}
  </div>
</div>

```

![Output of the Coupon codes web part with two coupon codes applied](https://docs.kentico.com/docsassets/k11/working-with-coupon-codes/Applying_coupon_codes.png "Output of the Coupon codes web part with two coupon codes applied")

After adding the _Coupon codes_ web part to your website's checkout pages, you can distribute coupon codes among your customers. Customers can then use these codes to receive discounts or redeem gift cards.

> **Note:** **Coupon code restrictions per order**
>
> When validating coupon codes, the system only accepts one code per discount for each order. For example, if a customer knows 2 different coupon codes for a 10% order discount, they can apply the codes to 2 different orders, but **cannot** apply both to a single order to get a 20% discount.
>
> [Gift cards](https://docs.kentico.com/k11/e-commerce-features/managing-your-store/discounts/working-with-gift-cards.md) are an exception to this rule – a single gift card can be applied multiple times to the same order with different coupon codes.
