Working with Buy X Get Y discounts
Buy X Get Y discounts in the Kentico E-commerce Solution are a cross-selling tool which allows you to increase sales of chosen products. The Buy X Get Y discounts application facilitates a number of shopping scenarios, such as:
- buy some of specified products, get the cheapest product for free, e.g., buy 3 pieces of clothes, get the cheapest one for free, or
- buy some of specified products, get a specific other product for free or with a discount, e.g. buy a computer, get Steve Jobs (E-book) for free, or buy Adidas Zebra Crew T-Shirt, get one more with a 50% discount.
To set up a basic Buy X Get Y discount:
- Open the Buy X Get Y discounts application.
- Click New Buy X Get Y discount.
- Type a Name for the discount.
- 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 one of the following options:
- products – for individual products
- products in sections – for entire sections of the product tree structure
- products in departments – for entire departments
- products with brands – for products with assigned brands
- products in collections – for products assigned to collections
- Products / Sections / Departments / Brands / Collections – depending on your choice in Buy any, select a list of either products, sections, departments, brands or collections.
- Minimum unit quantity – specify how many product units customers need to add to their shopping cart to be eligible for the discount.
- Buy any– select one of the following options:
- 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 as a percentage 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 as a percentage or fixed amount according to Discount.
- Click Save.
You have now created a Buy X Get Y discount. Whenever a customer fulfills the “Buy” conditions, they get the discount which you specified in the “Get” conditions. You can find the newly added discount with the lowest 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.
Effects of discount modification on already existing orders
If you edit or delete a discount, existing orders do not change and remain with the original discount. To update existing orders according to the new rules, you need to edit the orders manually.
Buy X Get Y discounts shopping examples
Example 1 – buy one item, get another one free (in other words, buy two items for the price of one): A 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 multiple items, get the cheapest one free: A customer adds multiple 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. The discount can also be less than 100%.
Example 3 – buy one item, get a gift: A customer adds a tennis racket to their shopping cart. The system automatically adds a pack of tennis balls (with a 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.
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” and select the Add product to cart automatically field.
Customers are not automatically notified when they have an opportunity to purchase a discounted product based on their current shopping cart content. To notify them, you can create a custom web part.
Changing Buy X Get Y discount priority
Buy X Get Y discounts are applied based on their priority. The discount priority is determined by the order of items in the discount listing. The higher the discount is, the higher its priority.
Priorities can be changed using drag-and-drop functionality. To change the priorities of your discounts:
Open the Buy X Get Y discounts application.
- The discounts are ordered according to their current priority.
Drag a discount using the Move () area to a different position in the listing.
If you cannot use drag-and-drop, expand the Other actions menu by clicking the Other actions button (…) and then click either Move up or Move down to change the discount’s priority.
(Optional) Edit () individual discounts and change the Apply lower priority discounts fieldas necessary. If cleared, no other Buy X Get Y discounts are applied to the shopping cart.
Buy X Get Y discounts are now applied based on the new order.
Note
- The system does not stack Buy X Get Y discounts for individual units of products. If multiple Buy X Get Y discounts apply to a single product that is added multiple times to the shopping cart, the system applies the discounts according to their priority. Each application “uses up” the number of product units specified in the discount’s “Buy” and “Get” conditions, and these units can no longer be processed by other Buy X Get Y discounts. - If you have a discount for a group of products, and want to set a larger discount for a specific product from the same group, you need to create a new discount with the total discount amount and assign it a higher priority. - Other discounts of a different type (e.g., volume discounts, product coupons) are still applied regardless of the Buy X Get Y priority.
Example – Buy X Get Y discount priority
The following example sets a 10% discount on any book and an additional 5% discount to every bought Steve Jobs (E-book) product.
Create a new discount for any book.
- Name: Buy a book, get 10% off
- Buy any: products in departments
- Departments: Books
- Amount: 10%
Create a new discount for the Steve Jobs (E-book) product.
- Name: Buy Steve Jobs, get 15% off
- Products: Steve Jobs (E-book)
- Amount: 15%
- That is 10% for any book and the additional 5% discount for Steve Jobs (E-book).
Drag the Steve Jobs (E-book) discount using the Move () area above the Buy a book, get 10% off discount in the listing.
Now when a customer adds a book to the shopping cart, the discount for all books applies. If the Steve Jobs (E-book) product is added to the shopping cart, the discount just for the book about Steve Jobs applies.
Displaying Buy X Get Y discount data to customers
To display information about applied Buy X Get Y discounts on your store’s checkout pages, you need to correctly format the data of the items in the current shopping cart.
When using the Shopping cart content web part, display Buy X Get Y discount data within the transformation applied to the shopping cart items. You can either call the GetMultiBuyDiscountNames transformation method or work with the DiscountSummary property of the transformed shopping cart items. For detailed information, see Displaying shopping cart details on pages.
Invoices and emails
In invoices and e-commerce notification templates, you can display Buy X Get Y discount data in the transformation applied to the ContentTable items (i.e. the product items in the related order).
To show customers the price reduction granted by Buy X Get Y discounts for each item, display the TotalDiscount value of the transformed order item. The property contains the sum of the discount values for all Buy X Get Y discounts and product coupons applied to the given order item.
<tr>
<td>{% HTMLEncode(Localize(SKUName)) %} {% HTMLEncode(SKUNumber) %}</td>
<td>{% Units %}</td>
<td>{% HTMLEncode(UnitPrice.Format(Currency.CurrencyFormatString)) %}</td>
<td>{% HTMLEncode(TotalDiscount.Format(Currency.CurrencyFormatString)) %}</td>
<td>{% HTMLEncode(TotalPrice.Format(Currency.CurrencyFormatString)) %}</td>
</tr>
If you wish to include detailed information about the applied Buy X Get Y discounts, you need to process the data available in the DiscountSummary property of order items. DiscountSummary is a collection of all Buy X Get Y discounts and product coupons that were applied to the given order item. Each record in the collection holds the following properties:
- Name – the name of the discount as specified in the Buy X Get Y discounts application.
- Value – the total amount saved after applying the discount to the given order item (for all product units).
To format the DiscountSummary, either iterate through the collection and manually generate the output, or call the ApplyTransformation macro method and define a Text / XML type transformation for the summary items.
{%
result = "";
if (DiscountSummary.Any()) {
result += "<ul>";
foreach (item in DiscountSummary) {
result += "<li>" + HTMLEncode(Localize(item.Name)) + " (" + HTMLEncode(item.Value.Format(Currency.CurrencyFormatString)) + ")</li>"
};
result += "</ul>";
}
return result;
%}
Reference
General |
|
Name |
The discount name that is displayed in the shopping cart, invoices, and emails. |
Code name |
The unique identifier of the discount object (for example used by developers in custom 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. |
Enabled |
If selected, the discount can be applied. If cleared, the discount is disabled. |
“Buy” Conditions |
|
Buy any |
Specifies the products that customers need to add to the shopping cart to obtain the discount.
For example, if you set the discount’s Minimum unit quantity to 3 and choose 6 products in this field, the “Buy” conditions are fulfilled whenever a customer adds any combination of 3 products from the given set to the shopping cart. Choose one of the options and then select the Products, Sections, Departments, Brands or Collections that fulfill the “Buy conditions”. |
Exclude |
You can optionally exclude products from the discount’s “Buy conditions” (unless the Buy any property is set to choose individual products). The exclusion options allow you to select product sections, brands or collections. Choose the products in sections, products with brands or products in collections option in the Exclude property and then select the Excluded sections, Excluded brands or Excluded collections. |
Minimum unit quantity |
Specify how many units customers need to add to their shopping cart to be eligible for the discount. For example, type 2 when:
|
“Get” Conditions |
|
Get |
Select what customers get if they fulfill “Buy” conditions.
|
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 as a percentage or a fixed amount.
|
Amount |
Specify the exact value of the discount. The amount must be a valid decimal number.
|
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 does not add the product when:
Customers cannot remove an automatically added product if they are entitled to it. If they try to remove the product, the system adds it again immediately. |
Coupons |
|
Customer has to redeem a coupon to get the discount |
If selected, only customers who enter a valid coupon code are able to apply the discount. You can define coupon codes on the Coupons tab in the left menu. After enabling the field and saving the discount, you will be redirected there automatically. See Working with coupon codes to learn more. Examples The examples show how the auto-adding feature works if the discount is coupon-based. Example 1:
Example 2:
Example 3:
|
Target customers |
|
Available for |
Determines which types of users are able to apply the discount:
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 customers on the Roles tab. |
Discount processing |
|
Apply lower priority discounts |
If selected, other Buy X Get Y discounts with lower priority are applied to the order as well. If cleared, processing of Buy X Get Y discounts stops with this discount. Note: The system does not stack Buy X Get Y discounts for individual units of products. If multiple Buy X Get Y discounts apply to a single product that is added multiple times to the shopping cart, the system applies the discounts according to their priority. Each application “uses up” the number of product units specified in the discount’s “Buy” and “Get” conditions, and these units can no longer be processed by other Buy X Get Y discounts. |
Limit use per order |
Determines how many times the system can apply the discount to a single order. If you leave the value empty, the number of discount applications is unlimited. For example, if a discount has the Minimum unit quantity set to 2 and a 100% discount on the cheapest product:
|
Valid to |
Specifies the time and date until which the discount is valid. If you leave the value empty, the discount is valid permanently (starting from the Valid from date). |
Valid from |
Specifies the time and date from which the discount is valid. If you leave the value empty, the discount applies at any time before the Valid to date. |
Buy X Get Y discount API
Buy X Get Y discounts are called MultiBuyDiscounts in the API. The basic API consists of the following classes:
- MultiBuyDiscountInfo – each object represents a Buy X Get Y discount (or product coupon).
- MultiBuyDiscountInfoProvider – provides management functionality for Buy X Get Y discounts (and product coupons).
The system applies Buy X Get Y discounts on the level of individual items in the shopping cart (each item can contain multiple units of the same product). In the API and macros, you can access related values using the following:
- ShoppingCartInfo.CartItems (ShoppingCartItems in macros) – a collection of all ShoppingCartItemInfo objects within a given shopping cart object.
- ShoppingCartItemInfo.TotalDiscount –decimal value containing the sum of all price reductions granted by Buy X Get Y discounts and product coupons applied to the given shopping cart item.
- ShoppingCartItemInfo.DiscountSummary – a collection of SummaryItem objects applied to the given shopping cart item. The collection contains both Buy X Get Y discounts and product coupons that apply to the shopping cart item.
- SummaryItem – a simplified data view used to summarize applied discounts. Contains only the Name and Value of the discount.