Set Up Magento 2 Buy X Get Y Free in a Jiffy

Buy X get Y free is one of the most common types of promotions that almost all retailers use to boost sales numbers.


For example, Magento 3 for 2 promotion!


Magento has grabbed this feature to its list of functions. As a result, users could easily and conveniently create, edit and manage the rule. Let’s see how to configure this function in Magento 2 to take full advantage of the package that you have invested in.

Magento 2- Buy X get Y free settings

LEARN ways to create >>> Magento 2 Cart Price Rules per Storeviews <<< NOW.

You will begin from the Admin sidebar, navigate to Store > Marketing > Promotions > Cart Price Rules.


Choose Add New Rule in the upper-right corner. Then you will see there are five main settings here:


Rule information: Set general information for the rule.


Conditions:  Choose which products to be applied for the rule.


Actions: Set terms for the rule.


Label: Choose the name showed at the front end.


Manage coupon codes: This will be enabled if you choose to use Specific Coupon code for this rule under Rule information setting.

open shopify store

Part 1: Start to create a new Magento 2 cart price rule

Complete the Rule Information settings as follows:

  • Fill out a Rule Name for internal reference.
  • Write a brief description to describe the rule
  • Set Status to “Active.”
  • Set Website to “Main Website.”

However, when your website has different store views, for instance, one for the local market and one for the global market. You should have 2 versions of this discount. Shopping Cart Price Rule per Store View for Magento 2 allows store owners to add different shopping cart price rules for each store view in Magento 2 then easily manage them.

  • Choose the Customer Groups to which the rule applies
Rule information settings
  • Choose No coupon if customers could gain this promotion without entering a coupon code

Choose Specific coupon if customers could gain the promotion only when they have a coupon code

Choose to use coupons or not

If you choose to use the coupon, follow the following steps.

Edit the coupon
  • Insert the Coupon code that is entered in the checkout process to get the discount.
  • Enable Use Auto Generation checkbox to publish the multiple coupon codes after saving the rule.
  • Limit the times of using the coupon in the Uses per Coupon and User per Customer. Leave them blank if there is no limitation.
    • Uses per Coupon define the number of times the coupon code is used.
    • Uses per Customers define the number of times that one coupon code is used by the same customer
    • If there is a number of cart price rules at the same time, you should set the active time and Priority to manage them better. (If you leave the date range empty, the rule will never expire).

Part 2: Define the conditions

In this setting, you choose conditions to apply this cart price rule. This condition can be a combination of conditions or a single one that will be examined before the rule is applied.

Define-conditionsThe default statement will be “If ALL of these conditions are TRUE”. Click the “plus” label to add more conditions.


Here is an example:

Cart price rule conditions – for example
  • Click the ALL link, and select “ALL” or “ANY.”
  • Click the TRUE link and select “TRUE” or “FALSE.”
  • Leave the condition field blank to apply the rule to all products

Part 3: Set up the actions

Edit the terms for the cart price rule
  • Set Apply to “Buy X get Y free (discount amount is Y).”
  • Set Discount Amount to define the number of products that the customer will receive for free.
  • To limit the number of items to get free, enter the number in the Maximum Qty Discount is Applied To field. For example, enter “3” to offer Magento 3 for 2 promotion.
  • In the Discount Qty Step (Buy X) field, enter the quantity that the customer must purchase to qualify for the discount.
  • Choose Discard Subsequent Rule to determine if additional rules can be applied to this purchase. To prevent multiple discounts from being applied to the same purchase
  • To set up specific products applicable to the rule. This condition or set of conditions will be examined after the condition(s) above in Conditions setting is/are satisfied.

Part 4: Put on the label

In the panel on the left, choose Labels. Then, do one of the following:

Put on the label
  • Fill out a Default Rule Label for All Store Views. This label will be visible to the customer in the totals section of the order to notify the discount  The label text is enclosed in parentheses, after the word, “Discount”.
  • If your store is available in multiple stores, enter Store View Specific Labels for each view.

Part 5: Manage the coupon codes

  • Set the Code Length to define the length of the coupon code, excluding the prefix, suffix, and separators.
  • Set the Code Format to define the coupon code format. Options are:

Alphanumeric: Any combination of letters and numbers

Alphabetical: Letters only

Numeric: Numbers only

  • Code Prefix: A value appended to the beginning of all coupon codes. Leave blank to omit the prefix
  • Code Suffix: A value appended to the end of all codes. Leave blank to omit the suffix
  • Dash Every X Characters: An interval where a dash (-) can be inserted into all coupon codes. If you do not want to use a dash, leave the field blank

Following is our sample

Coupon codes are generated
Coupon codes sample with prefix and suffix

These are all the steps that you will walk through to set up the buy X get Y free discount. We hope that you can quickly apply this guide to your site. We always welcome you to share more knowledge with us. If you find this article useful, let us know! Or if you got any new ideas on this article, tell us too!


We are one of the leading Magento extension providers and web development services in the world. With experienced and certified Magento developers, we commit to bring high-quality products and services to optimize our business effectively. Let us know about your problems. We are willing to support you every time.

Write A Comment