---
title: Example - Applying a coupon code to receive a discount on selected products
---

> 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).

This example demonstrates how to create and apply a [product coupon](https://docs.kentico.com/13/e-commerce-features/managing-on-line-stores/discounts/working-with-product-coupons.md) that grants a discount on selected [products](https://docs.kentico.com/13/e-commerce-features/managing-on-line-stores/products.md). The discount applies to all coffee products and grants 10 % off the price of each product.

The example uses the _Dancing Goat MVC_ sample site.

## Adding a product coupon

First, you need to add a new product coupon.

1. Open the **Product coupons** application.
2. Click **Enter product coupon**.

   - The system opens a page where you can specify the coupon properties.
3. Enter the following values for the coupon's properties:

   - **Name**: Coffee discount coupon
   - **Enabled**: Yes (selected)
   - **Applies to**: products in departments
   - **Departments**: _click_ **Select departments** _and choose_ **Coffees**
   - **Discount**: percentage
   - **Amount**: 10
4. Click **Save**.

The system creates a new product coupon and redirects you to the **Coupons** tab. Here you need to generate or manually create coupon codes.

1. Click **Create coupon code**.
2. Type _COF-10_ into the **Coupon code** field.
3. Click **Save**.

The product coupon is now ready for use. If your [customers](https://docs.kentico.com/13/e-commerce-features/managing-on-line-stores/customers.md) add any products from the _Coffees_ department to their shopping carts and apply the _COF-10_ coupon code, they receive a 10% discount on each of the products.

## Applying the coupon code

### While shopping on the live site

1. View the live site.
2. Select **Store -> Coffee** in the store's main menu.
3. Click a certain type of coffee to view its details, enter a quantity and click **Add to cart**. You can repeat the process for multiple types of coffee.

   - The system displays the content of your shopping cart, allowing you to enter a coupon code.
4. Type the _COF-10_ coupon code into the **Discount coupon** field and click **Apply**.

The system applies the discount on the product and recalculates the order. The sample site displays the product coupon's 10% discount separately for each item in the shopping cart. If you now click **Checkout**, you can continue in the checkout process.

### While editing an existing order in the administration interface

1. Open the **Orders** application.
2. **Edit** () the selected [order](https://docs.kentico.com/13/e-commerce-features/managing-on-line-stores/orders.md).
   - Make sure you select an order containing at least one product from the _Coffees_ department.
3. Switch to the **Items** tab.
4. Enter the coupon code:

   - **If you have a coupon, please enter it here**: COF-10
5. Click **Update**.

   ![Applying a product coupon to an order in the administration interface](https://docs.kentico.com/docsassets/13/example-applying-a-coupon-code-to-receive-a-discount-on-selected-products/entering_product_coupon_code.png "Applying a product coupon to an order in the administration interface")
6. Click **OK** to save the application of the product coupon into the order.

The system applies the product coupon's 10% discount. You can see the sums of the discount values in the **Discount** column of each order item, and when viewing the price details ().
