Skip to main content

Advanced promotions guide - part 2 - Magento built-in "Buy X get Y" promotion

· 5 min read

In this series, we cover Magento price cart rules in depth. This is the second part of our promo series, and it will deal with the Magento buy x get y promotion.

Part 2 - buy x get y free in Magento

In this part, we will look closely at the buy x get y free promotion. Examples:

  • buy one get one free
  • buy x get y free
  • magento 3 for 2 promotion

(If you are interested in the other three core promotion types—percentage, fixed, and fixed discount for the whole cart—please refer to Part 1 of this series.)

How do you configure a buy one get one free in Magento?

As we will see, Magento's out-of-the-box cart rules only allow the buy x get y free promotion for the same product. That is, if the customer adds X quantity of a specific product, he gets the extra Y quantity of the same product for free.

That is, for the following promotion examples, you won't be able to use the Magento buy x get y price cart rule:

  • 1+1 on all t-shirts - where one t-shirt has an SKU TSHIRT1, and the other (free) t-shirt has an SKU TSHIRT2
  • Buy a t-shirt, get an accessory free

To create such promotions, you will need to use an advanced promo extension for Magento.

Buy X get Y free - same product

Let's go back to the out-of-the-box Magento buy one get one free promotion. Let’s take a look at a few examples.

“1+1 on all t-shirts”

This promotion will allow you to add another quantity of (the same) t-shirt for free.

Promo configuration

To configure it, choose “Buy X get Y (discount amount is Y)” -

Magento price cart rule configuration, the buy x get y action type is selected

Set the value 1 in “Discount Amount” and 1 in “Discount Qty Step (Buy X).”

In order for the cart rule to apply the discount only on the t-shirt category, we need to add a condition in the “Actions” tab.

To do that, go to the “Actions” tab.

Scroll down to the “Apply the rule only to cart items matching the following conditions (leave blank for all items)” field, and then choose the categories of t-shirts. In our example, we choose two categories—women’s t-shirts and Men’s t-shirts—and use the “Category is one of” condition.

Save the promo.

Promo results
Adding two of the same products

In the cart and the mini-cart, we can see that if we add two of the same t-shirts, we get one of them for free.

The mincart in Magento website, with the buy one get one discount applied, and one quantity of the item is free.

  • Out-of-the-box, Magento doesn’t display discounts in the mini cart (marked by the blue ellipse).
  • If you want this feature on your site, we suggest you look into our advanced promotions plugin for Magento, which contains this and many other valuable features.
Adding four of the same products

As expected, if we add four of the same t-shirts, we will get two free.

Magento cart with four same t-shirt in the cart, two of them got discounted

Adding two different products

Let's see what happens when we add two different t-shirts to the cart.

Magento cart with two different t-shirts added, there is no discount applied in the cart

As expected, no discount has been applied. As we mentioned before, the out-of-the-box Magento buy x get y shopping cart price rule only allows discounting the extra quantity of the same exact item.

If we change the quantity of each item to two, they will get discounted.

Magento cart with two different t-shirts added, each with quantity of two, a discount is applied on each second t-shirt

  • Out-of-the-box, Magento doesn’t display discounts in the mini cart (marked by the blue ellipse).
  • If you want this feature on your site, we suggest you look into our advanced promotions plugin for Magento, which contains this and many other valuable features.
Limiting the number of discounted products

If we want to limit the discount quantity per product, we need to fill in the “Maximum Qty Discount is Applied To” field.

Pay attention to the fact that the field should contain a value according to the following formula - Formula = (X+Y) * (M/Y) X = number of items purchased Y = number of free items M = Maximum number of free items allowed

(source: Adobe Commerce documentation - https://experienceleague.adobe.com/en/docs/commerce-admin/marketing/promotions/cart-rules/price-rules-cart-buy-this-get-that)

That is, in the example above, if we want to limit the discounted quantity to two, our values will be: X = 1 Y = 1 M = 2 So the formula will yield (1+1)*(2/1) = 4

So if we fill 4 in “Maximum Qty Discount is Applied To,” we can get a maximum quantity of two for free of each matching product.

3 for 2 promotion

3 for 2 promotion is the same as buy two get one free. Therefore, we can configure it similarly to how we did before.

The only difference is that we fill in 2 in the “Discount Qty Step (Buy X).” The field “Discount Amount” remains 1.

If we want to set the maximum discount quantity to be two, we will go by the previous formula:

Formula = (X+Y) * (M/Y) Where X = number of items purchased Y = number of free items M = Maximum number of free items allowed X = 2, Y = 1, M = 2

So the formula will yield (2+1)*(2/1) = 6

So if we fill 6 in “Maximum Qty Discount is Applied To,” we can get a maximum quantity of two for free of each matching product.