{"id":2526,"date":"2024-12-31T20:22:45","date_gmt":"2024-12-31T20:22:45","guid":{"rendered":"https:\/\/meetanshi.com\/blog\/how-to-setup-buy-x-get-y-free-in-magento-2\/"},"modified":"2025-07-16T15:02:10","modified_gmt":"2025-07-16T09:32:10","slug":"setup-buy-x-get-y-free-in-magento-2","status":"publish","type":"post","link":"https:\/\/meetanshi.com\/blog\/setup-buy-x-get-y-free-in-magento-2\/","title":{"rendered":"How to Setup Buy X Get Y Free in Magento 2"},"content":{"rendered":"\n<p class=\"wp-block-paragraph\">Discounts and offers are some of the great ways to entice customers and boost sales during peak seasons. There are plenty of ways to offer lucrative deals to the customers. One such way to&nbsp;<a href=\"https:\/\/meetanshi.com\/blog\/magento-2-extensions-to-boost-sales\/\" target=\"_blank\" rel=\"noreferrer noopener\">leverage sales<\/a>&nbsp;and increase the average order value on your store is a \u2018Buy X, Get Y Free\u2019 offer in Magento 2.<br><\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Using the \u2018Buy X, Get Y Free\u2019 in Magento 2, you can offer a Y quantity of products for free to the customers with a purchase of X quantity of products. The default\u00a0Magento 2\u00a0allows offering such deals on the store using the\u00a0<a href=\"https:\/\/meetanshi.com\/blog\/add-magento-shopping-cart-price-rules\/\" target=\"_blank\" rel=\"noreferrer noopener\">cart price rules<\/a>. In this article, I am going to cover how you can\u00a0<em><strong>setup Buy X Get Y Free in Magento 2<\/strong><\/em>.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Let\u2019s go!<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Steps to Setup Buy X Get Y Free in Magento 2<\/h2>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"step1\">Step 1:&nbsp;Set up the Cart Price Rule<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">First of all, set up a new cart price rule in your Magento 2 store. You can refer to this step-wise guide:&nbsp;<a href=\"https:\/\/meetanshi.com\/blog\/add-magento-shopping-cart-price-rules\/\" target=\"_blank\" rel=\"noreferrer noopener\">Create Cart Price Rule in Magento 2<\/a>.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"step2\">Step 2: Define the Conditions<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">Once you have filled the cart price rule information, scroll down and expand the \u2018Conditions\u2019 section. You can set different conditions to apply the \u2018Buy X Get Y Free\u2019 offer to the products in your Magento 2 store. You can also choose to apply the offer if All or Any of the conditions are True or False based on your requirements.<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img decoding=\"async\" src=\"https:\/\/meetanshi.com\/blog\/wp-content\/uploads\/2022\/04\/Set-up-Buy-X-Get-Y-Free-in-Magento-2-Set-Conditions-700x115-1.png\" alt=\"Set up Buy X Get Y Free in Magento 2 Set Conditions\" class=\"wp-image-50239\"\/><\/figure>\n\n\n\n<p class=\"wp-block-paragraph\">You can set various conditions to trigger the cart price rule. You can use the combination of the following:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Product attribute combination<\/li>\n\n\n\n<li>Product subselection<\/li>\n\n\n\n<li>Conditions combination<\/li>\n\n\n\n<li>Cart Attribute<\/li>\n<\/ul>\n\n\n\n<p class=\"wp-block-paragraph\">Add various conditions or combinations of conditions as per your choice to trigger the Buy X Get Y Free in Magento 2.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"step3\">Step 3:&nbsp;Define the Actions<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">Once you have set the conditions, scroll down and expand the \u2018Actions\u2019 section. Select \u2018Buy X get Y free\u2019 in the Apply field and configure the following settings:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li><strong>Discount:&nbsp;<\/strong>Enter how many products you want to offer for free, i.e. Y. Enter 1 in case you are setting up Buy 3 Get 1 Free.<\/li>\n\n\n\n<li><strong>Maximum Qty Discount is Applied To:&nbsp;<\/strong>Enter the maximum quantity of items on which the discount can be applied.<\/li>\n\n\n\n<li><strong>Discount Qty Step (Buy X):&nbsp;<\/strong>Enter the minimum required quantity of products to offer the discount, i.e. X. Enter 3 in case you are setting up Buy 3 Get 1 Free in Magento 2.<\/li>\n<\/ul>\n\n\n\n<figure class=\"wp-block-image size-full\"><img decoding=\"async\" src=\"https:\/\/meetanshi.com\/blog\/wp-content\/uploads\/2022\/04\/setup-buy-3-get-1-actions-magento-2-700x279-1.png\" alt=\"setup buy 3 get 1 actions magento 2\" class=\"wp-image-50240\"\/><\/figure>\n\n\n\n<p class=\"wp-block-paragraph\">You can also choose to apply the discount offer to the shipping amount and override the subsequent cart price rules.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"step4\">Step 4:&nbsp;Set the Labels<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">After setting the actions, scroll down and expand the \u2018Labels\u2019 section. Here you can enter the labels for the rule for the default store and other store views.<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img decoding=\"async\" src=\"https:\/\/meetanshi.com\/blog\/wp-content\/uploads\/2022\/04\/Buy-X-Get-Y-Free-in-Magento-2-Set-Labels-700x173-1.png\" alt=\"Buy Get Y Free in Magento Set Labels\" class=\"wp-image-50241\"\/><\/figure>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"step5\">Step 5:&nbsp;Apply the Rule<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">Once you have configured the rule properly, click on the \u2018Save Config\u2019 button to activate the Buy X Get Y Free offer in your Magento 2 store. It is advisable to test the rule by yourself to ensure that there are no errors in configuration and everything is working fine.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Additionally, you can&nbsp;<a href=\"https:\/\/meetanshi.com\/blog\/add-a-free-shipping-bar-to-magento-2\/\" target=\"_blank\" rel=\"noreferrer noopener\">add a free shipping bar to Magento 2<\/a>&nbsp;and get it noticed by the customers.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"examples\">Examples of Buy X Get Y Free in Magento 2<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">There are plenty of ways to leverage sales in your store using the Buy X Get Y free in Magento 2. Provided below are some of the practical examples of how you can set up different promotional discount rules in Magento 2.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"example1\">Example 1: Buy X Get Y Free for Specific Products<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">Let\u2019s say you have plenty of dormant products of specific categories in your inventory that are not selling well. You can leverage the sales of low-selling products in your Magento 2 store by offering Buy X Get Y free offers on those products only. You can limit the offer only to specific SKUs using the conditions.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>For example:<\/strong><\/p>\n\n\n\n<p class=\"wp-block-paragraph\">If ALL of these conditions are TRUE:<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">SKU is 123, 234, 345<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img decoding=\"async\" src=\"https:\/\/meetanshi.com\/blog\/wp-content\/uploads\/2022\/04\/Set-up-Buy-X-Get-Y-Free-in-Magento-Product-wise-700x105-1.png\" alt=\"Set up Buy X Get Y Free in Magento Product wise\" class=\"wp-image-50243\"\/><\/figure>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"example2\">Example 2: Limit the Maximum Number of Freebies<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">Suppose you want to limit the maximum number of free products that the customer can avail of, then you can use the following formula to calculate the maximum Qty Discount:<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>Formula = (X+Y) * (M\/Y)<\/strong><br>where<br>X = number of items purchased<br>Y = number of free items<br>M = Maximum number of free items allowed<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>For Example:&nbsp;<\/strong>If you want to allow maximum of 6 free products (M=6) on your store using the Buy 2 Get 1 Free offer (X=2, Y=1), the maximum Qty discount can be calculated as:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Max Qty Discount = (X+Y) * (M\/Y) = (2+1) * (6\/1) = 18<\/li>\n<\/ul>\n\n\n\n<h2 class=\"wp-block-heading\">Conclusion<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">Buy X Get Y free in Magento 2 is one of the amazing ways to encourage the customers to purchase more products in your store, leverage sales, and&nbsp;<a href=\"https:\/\/meetanshi.com\/blog\/increase-average-order-value-in-ecommerce\/\" target=\"_blank\" rel=\"noreferrer noopener\">increase the average order value<\/a>. Magento 2 supports setting up such discount offers by default using the cart price rule. It can be customized by setting different conditions, actions, and labels as per the requirements.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">I hope this guide will help you to set up Buy X Get Y free in Magento 2. <\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Thanks for reading!<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Discounts and offers are some of the great ways to entice customers and boost sales during peak seasons. There are plenty of ways to offer&#8230;<\/p>\n","protected":false},"author":32,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"footnotes":""},"categories":[34],"tags":[],"class_list":["post-2526","post","type-post","status-publish","format-standard","hentry","category-magento"],"acf":[],"_links":{"self":[{"href":"https:\/\/meetanshi.com\/blog\/wp-json\/wp\/v2\/posts\/2526","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/meetanshi.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/meetanshi.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/meetanshi.com\/blog\/wp-json\/wp\/v2\/users\/32"}],"replies":[{"embeddable":true,"href":"https:\/\/meetanshi.com\/blog\/wp-json\/wp\/v2\/comments?post=2526"}],"version-history":[{"count":4,"href":"https:\/\/meetanshi.com\/blog\/wp-json\/wp\/v2\/posts\/2526\/revisions"}],"predecessor-version":[{"id":17956,"href":"https:\/\/meetanshi.com\/blog\/wp-json\/wp\/v2\/posts\/2526\/revisions\/17956"}],"wp:attachment":[{"href":"https:\/\/meetanshi.com\/blog\/wp-json\/wp\/v2\/media?parent=2526"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/meetanshi.com\/blog\/wp-json\/wp\/v2\/categories?post=2526"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/meetanshi.com\/blog\/wp-json\/wp\/v2\/tags?post=2526"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}