---
title: Example - Applying a Buy X Get Y discount
related:
  - https://docs.kentico.com/k10/e-commerce-features/managing-your-store/discounts/working-with-buy-x-get-y-discounts.md
  - https://docs.kentico.com/k10/e-commerce-features/managing-your-store/discounts/working-with-buy-x-get-y-discounts/example-applying-a-buy-x-get-y-discount-2.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 example demonstrates an application of a Buy X Get Y discount. The example uses the sample _E-commerce Site_.

We want every [registered customer](https://docs.kentico.com/k10/managing-users/role-management.md) to get free book _Responsive Web Design_ for buying any piece of electronics from _Electronics_ department. The book should be added automatically to customer's shopping cart. Customer should get only one book even if they buy more electronic equipment. The discount is not time-limited, and is applied while shopping on the live site, and while editing an existing [order](https://docs.kentico.com/k10/e-commerce-features/managing-your-store/orders.md) in the administration interface.

## Adding a Buy X Get Y discount

To add a Buy X Get Y discount, you have to follow several steps. Remember that the discount is saved after finishing all steps.

### Create a new Buy X Get Y discount and fill the general properties

1. Open **Buy X Get Y discount** application.
2. Click **New Buy X Get Y discount**.

   ![New Buy X Get Y discount button](https://docs.kentico.com/docsassets/k10/example-applying-a-buy-x-get-y-discount-1/new_buy_x_get_y_discount_button.png "New Buy X Get Y discount button")
3. Enter the following values to discount's general properties:
   - **Name**: Buy electronics get a book
   - **Enabled**: Yes (selected)

We created a new discount which we named.

### Fill in "Buy" Conditions and "Get" Conditions

1. In the **"Buy" Conditions** category, select _products in departments_ in the **Buy any** field.
2. Click **Select departments**.
3. Select _Electronics_, and click **Select**.

   ![Select departments](https://docs.kentico.com/docsassets/k10/example-applying-a-buy-x-get-y-discount-1/select_departments.png "Select departments")
4. In the **"Get" Conditions** category, choose _specific product for discounted amount_ in the **Get** field.
5. Click **Select** next to the **Specific product** field.
6. Find and select _Responsive Web Design_.
7. In **Discount**, select _percentage_.
8. To **Amount**, enter _100_.
9. Select **Add product to cart automatically**.

   > **Info:** **Add product to cart automatically** appears when you enter _100_ to **Amount** and click somewhere else or press **Enter**.

   ![Buy and Get conditions](https://docs.kentico.com/docsassets/k10/example-applying-a-buy-x-get-y-discount-1/buy_get_conditions.png "Buy and Get conditions")

You have now a discount that automatically adds Responsive Web Design book for free to shopping carts with any piece of electronics.

### Add other discount properties and save it

1. In the **Target customers** category, select _Registered_ users.
2. Unwrap the **Discount processing** category and enter _1_ to **Limit user per order**.
3. Click **Save**.

The system saves the discount. The discount adds Responsive Web Design book for free to registered users' shopping carts with any computer or computers.

## Applying the Buy X Get Y discount

### While shopping on the live site

1. View the live site.
2. Sign in as a customer (user).
3. Select **Electronics** in your on-line store main menu.
4. Click **Add to cart** at any piece of electronics, e.g., _Apple iPhone 4S_.

   > **Info:** The product has product options. That's why the system now displays the product's details page.
5. Click **Add to cart** again.

   - The system displays the content of the shopping cart of the customer (user) in the selected role, with the discount applied on the order.

     ![Shopping cart content with discount](https://docs.kentico.com/docsassets/k10/example-applying-a-buy-x-get-y-discount-1/buy_x_get_y_shopping_cart_content.png "Shopping cart content with discount")

You have now applied the discount. You got a free book to some piece of electronics. If you now click **Check out**, you can continue with the [checkout process](https://docs.kentico.com/k10/e-commerce-features/configuring-your-store/checkout-process.md).

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

1. Open the **Orders** application.
2. **Edit** () the selected order.
3. Switch to the **Items** tab.

   ![Shopping cart before discount](https://docs.kentico.com/docsassets/k10/example-applying-a-buy-x-get-y-discount-1/shopping_cart_before_discount.png "Shopping cart before discount")
4. Click **Add item**.
5. Select some piece of electronics, e.g., _Apple iPhone 4S_.
6. Click **Add to cart**.

   ![Shopping cart with discount](https://docs.kentico.com/docsassets/k10/example-applying-a-buy-x-get-y-discount-1/shopping_cart_with_discount.png "Shopping cart with discount")

The system automatically added a free book. If you click **Next** or **OK** (depending on the type of the order), you can proceed with order editing.
