Is this really the version you are looking for? Kentico 8.1 documentation is no longer updated. Use the switch in the header to choose your Kentico version.

Working with Buy X Get Y discounts

Buy X Get Y discounts in Kentico E-commerce Solution allow you to increase sales of chosen products. The Buy X Get Y discounts application facilitates a number of shopping scenarios, such as:

  • buy a product, get another item of the same product for free,
  • buy a number of items of the same product, get one of them for a discounted price,
  • buy products from a department, get the cheapest product for free, or
  • buy one or more products, get a specific product (a gift) for free.

To set up a basic Buy X Get Y discount:

  1. Open the Buy X Get Y discounts application.
  2. Click New Buy X Get Y discount.
  3. Type a Name for the discount.
  4. Specify "Buy" conditions. Buy conditions indicate the products that customers need to add to their shopping cart to be eligible to get products for free or with a discount.
    • Buy any – select product(s) to select individual products; select product(s) in department to select specific departments.
    • Products or Departments – depending on your choice in Buy any, click Select products or Select departments to select either products or departments.
    • Minimum unit quantity – specify how many units customers need to add to their shopping cart to be eligible for the discount.

  5. Specify "Get" conditions. Get conditions define what products customers get for free or with a discount.
    • Get – select cheapest unit for discounted amount to automatically apply the discount to the cheapest product from the set specified in "Buy" conditions; select specific product for discounted amount to define a product that will be added to the customer's order as a gift.
    • Specific product – appears if you selected specific product for discounted amount in Get.
    • Discount – select percentage to apply the discount in percent or fixed amount to apply the discount in a specific amount of money in the main currency.
    • Amount – specify an exact value of the discount either in percent or in fixed amount according to Discount.

  6. Click Save.

Now, you have a completed Buy X Get Y discount. Whenever a customer fulfills "Buy" conditions, they will get the discount which you have just specified in "Get" conditions. You can find the newly added discount with the highest priority at the end of the Buy X Get Y discount list. To create more complex Buy X Get Y discount, see all parameters below.

If you edit or delete a discount, the existing orders stay with that discount. To update existing orders according to the new rules, you have to manually edit the involved orders.

Buy X Get Y discounts behavior in the shopping cart

In a typical Buy X Get Y scenario, a customer adds a product into their shopping cart. The on-line store then automatically adds a second product to the shopping cart, for example as a gift for the customer. In case of a Buy one Get one offer, Buy N Get cheapest free, or other similar scenarios involving multiple products triggering a discount or a giveaway, the customer must add the specified number of items into the shopping cart and then gets a discount on one or more of the added products.

Buy X Get Y shopping examples

Example 1 – buy one item, get another one free (in other words, buy two items for the price of one): Customer adds two pairs of jeans to their shopping cart. The system automatically applies a 100% discount on one of the items. If a customer adds only one pair of jeans to their shopping cart, another pair is not added automatically.

Example 2 – buy three items, get the cheapest one free: Customer adds three different books to the shopping cart. The system evaluates which item has the lowest price (before applying other discounts) and applies a 100% discount on that item. See a specific example.

Example 3 – buy one item, get a gift: Customer adds a tennis racket to their shopping cart. The system automatically adds a pack of tennis balls (with 100% discount) to the shopping cart. If the customer adds the balls first and then the racket, the system applies a 100% discount on the set of balls which has already been added. See a specific example.

The system adds products to the shopping cart automatically only if you set the "Get" condition of the particular Buy X Get Y discount to "specific product".

Customer is not notified that they have an opportunity to purchase a discounted product if so.

Changing Buy X Get Y discount priority

Buy X Get Y discounts are applied based on their priority. Once a discount that doesn't have the Apply lower priority discounts option selected is applied, no other Buy X Get Y discounts are applied to the shopping cart.

  1. Open the Buy X Get Y discounts application.
  2. Click on the number in the column Priority in the row of a discount.
  3. Change the number to the desired one. The number must be greater than one.

    Use greater intervals between priority numbers. If you want to add a new discount inbetween two already existing, you can add the new discount more easily between 10 and 20 than between 1 and 2. If you already have only small gaps, you can also use decimals.

  4. Press Enter or click on the green confirmation button () next to the number.
  5. (Optional) Edit () individual accounts and change the Apply lower priority discounts as necessary.

Buy X Get Y discounts are now applied based on the priority that you assigned to them. Note that standard discounts are still applied.

Displaying Buy X Get Y discounts data on pages, in invoices, and e-mails

You can use the Shopping Cart Totals web part with transformations to display Buy X Get Y discounts on a page, e.g., in the shopping cart.

In invoices and e-mailes, you can use the following macros to display Buy X Get Y discount data. Note that in code Buy X Get Y discounts (along with order discounts) are called OrderRelatedDiscountSummaryItems.

  • OrderRelatedDiscountSummaryItems – a collection of Buy X Get Y discounts and order discount applied to items in a particular shopping cart instance. The collection's items hold following values:
    • Value – the amount saved after applying the discount, e.g., 50 % of the price of a product.
    • Name – the name of the discount as specified in the Buy X Get Y discounts application.

To extract the value-name pairs from the OrderRelatedDiscountSummaryItems collection, use the following macro:

{% OrderRelatedDiscountSummaryItems.ApplyTransformation("Ecommerce.Transformations.Order_OrderRelatedDiscountsContent", "Ecommerce.Transformations.Order_OrderRelatedDiscountsHeader", "Ecommerce.Transformations.Order_OrderRelatedDiscountsFooter") %}

The default installation of Kentico contains ready-to-use transformations with Buy X Get Y discounts in mind. The parameters of the ApplyTransformation method used in the code example are names of the default transformations. The default transformations are stored in the E-commerce transformations page type.

Reference

General
NameThe discount name that is displayed in the shopping cart, invoices, and e-mails.
Code name

The unique identifier of the discount object used by developers in the code.

Unless there is a reason to set a particular value, you can leave the default (automatic) option, and the system generates an appropriate code name automatically.

EnabledIf selected, the discount is allowed to be applied. If cleared, the discount is disabled.
"Buy" Conditions
Buy any

Sets what customer must add to the shopping cart to obtain the discount.

  • Product(s) – allows you to choose individual products.
  • Product(s) in department(s) – allows you to choose whole departments of products.

E.g., if you set the discount to be applied when customer buys 3 products in Minimum unit quantity and you choose 6 products in this field, customer fulfills the "Buy" conditions whenever they put any combination of products in this field to the shopping cart.

Products

Appears when you select product(s) in Buy any.

Select specific product, or products. Customer can add any combination of the products to the shopping cart to fulfill the "Buy" conditions.

Departments

Appears when you select product(s) in department(s) in Buy any.

Select specific department, or departments. Customer can add any products from the selected department, or departments to fulfill the "Buy" conditions.

Minimum unit quantity

Specify how many units customers need to add to their shopping cart to be eligible for the discount.

E.g., enter 2 when:

  • customer adds 2 products to the shopping cart, and gets another product for free,
  • customer adds 3 products to the shopping cart, and one of them gets a discount.
"Get" Conditions
Get

Select what customers get if they fulfills "Buy" conditions.

  • Cheapest unit for discounted amount – the cheapest unit from the selected products customer added to the shopping cart gets the discount.
  • Specific product for discounted amount – the system adds a specific product to customer's shopping cart, or customers have an option to add a specific product to their shopping cart for a discounted price.
Specific product

Appears when you select specific product for discounted amount in Get.

Select specific product which gets the discount.

Discount

Specify if you want to apply the discount in percentage or in fixed amount.

  • Percentage – the cheapest unit or the product according to Get gets the discount in percentage of its price.
  • Fixed amount – the cheapest unit or the product according to Get gets the discount in a specific amount of money in the on-line store main currency.
Amount

Specify an exact value of the discount in percent or in fixed amount according to Discount.

The amount has to be a number. When the amount is in percentage, enter a number between 0 and 100. When the amount is fixed, enter a number greater than 0.

Add product to cart automatically

Appears when you select specific product for discounted amount in Get, and when Amount is 100 %.

If selected, the system adds the specified product to the shopping cart automatically when the shopping cart fulfills the "Buy" conditions

If you choose a specific product to be added automatically to the customer's order as a gift, the system won't add the product when:

  • you choose a product with product options (but you can choose a product variant), or
  • the discounted product is not allowed for sale, or
  • the discounted product is allowed to be sold only if items are available and there is no available item left.

If customer removes an automatically added product, the system will add it again immediately.

Coupons
Customer has to redeem a coupon to get the discount

If selected, only customers who type valid coupon code are able to apply the discount.

You can set coupons on the Coupons tab in the left menu. After enabling the field and saving the discount, you will be redirected there automatically.

More info about working with coupons is to be found in separate page.

 Examples...

The examples show how the auto-adding feature works if the discount is coupon-based.

Example 1:

  • Customer adds X to the cart, Y is not auto-added.
  • Customer types coupon code, Y is auto-added.
  • Customer removes coupon code, Y is auto-removed.

Example 2:

  • Customer adds X to the cart, Y is not auto-added.
  • Customer adds Y.
  • Customer types coupon code, Y in the shopping cart is recalculated as free.

Example 3:

  • Customer types coupon code.
  • Customer adds X to the cart, Y is auto-added.
Duration
Valid from

Specify from when the discount is running.

If you leave Valid from empty, the discount will be valid permanently till Valid to.

Valid to

Specify to when the discount is running.

If you leave Valid to empty, the discount will be valid permanently from Valid from.

Target customers
Available for

Choose roles of users who are able to apply the discount:

  • All visitors – all customers are eligible for the discount.
  • Registered users – only registered customers are eligible for the discount.
  • Selected roles – only customers in selected roles are eligible for the discount. To add roles:
    1. Click Select roles to open the Select roles dialog.

    2. Select the required roles.

    3. Click Select.

You can enter roles directly by typing in their code names separated by semicolons, e.g., _authenticated_;Members.

You can add registered customers to roles in the Customers application while editing a selected customer on the Roles tab.

Discount processing
Apply lower priority discountsIf selected, other Buy X Get Y discounts with lower priorities are applied to the shopping cart as well. If cleared, discount processing stops with this discount.
Limit use per order

Set how many times customer is allowed to apply the discount in one order.

 Example...

Example with Minimum unit quantity set to 2 and a 100% discount to the cheapest product.

  • Customer adds 3 products to his shopping cart.
  • In the shopping cart, the system applies a 100% discount to the cheapest product.
  • If the customer adds another 3 products, they will have 6 products in total. When Limit user per order is set to unlimited, the system applies the discount twice, so the two cheapest products are for free. When Limit user per order is set to 1, the system applies the discount only once, so only the one cheapest product is for free.

Buy X Get Y discounts API

Buy X Get Y discounts are called MultiBuyDiscounts in the API. The API comprises the following objects:

  • MultiBuyDiscountInfo – stores information about the discount
  • DiscountSummaryItem – simplified view on the discount data, contains only the name and value of the discount
  • ShoppingCartInfo.OrderRelatedDiscountSummaryItems property – collection of DiscountSummaryItem objects applied to products in the current shopping cart