# Buy X Get Y

The **Buy X Get Y** rule allows you to create **gift-oriented promotions** where customers receive **free products or discounted items** after purchasing specific products.

With this rule type, you can define which products trigger the promotion by selecting:

* Product categories
* Product names
* Variations
* Product tags
* Price ranges
* Specific products

Once the conditions are met, customers can receive a **free item or a discounted product** from the list you define.

<figure><img src="https://2582339638-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FagGARFBou99u1ioIn7vL%2Fuploads%2FukB3AEX1YjP0zwjayVa7%2Fbxgy.jpg?alt=media&#x26;token=75773965-80dd-4293-b5ca-bec1b8d77f51" alt=""><figcaption><p>Buy X get Y setting rule</p></figcaption></figure>

### Count Quantity By

The **Count quantity by** option determines how the system calculates the product quantity required to trigger the promotion.

<figure><img src="https://2582339638-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FagGARFBou99u1ioIn7vL%2Fuploads%2FgrACG2vxqPBblQ6yP4gs%2Fcount.jpg?alt=media&#x26;token=359e9317-d760-4b77-9f9b-ff11a02957cd" alt=""><figcaption></figcaption></figure>

* The **All together** option calculates the total quantity of all items in the cart, regardless of product type. It applies the bulk discount based on the combined total quantity. For example, 5 units of Product A and 3 of Product B would total 8 units, triggering the discount
* The **Item quantity in each cart line** option calculates discounts based on the quantity of each product in separate cart lines. Each product's discount is applied independently. For example, 5 units of Product A and 3 units of Product B will receive discounts based on their individual quantities
* The **Each single product/variable product** option treats each product variant (e.g., size, color) as separate items for quantity calculation. Discounts apply based on the quantity of each variant. For example, 3 units of "Small" and 4 units of "Medium" will receive separate discounts based on their individual quantities.

### Repeat Rule

The **Repeat** option allows you to determine whether the promotion **can be applied multiple times** within the same cart.

* **Enabled:** The rule repeats for every qualifying quantity.
* **Disabled:** The promotion applies only **once per order**.

### Buy Products

The **Buy Products** field allows you to define **which products customers must purchase** in order to trigger the promotion.

You can select products based on:

* Categories
* Specific products
* Tags
* Variations
* Price filters

### Get Products

The **Get Products** field lets you define **which products customers receive as a free or discounted item**.

These products will appear as the **eligible reward items** when the promotion conditions are met.

### Apply Mode

The **Apply Mode** setting determines **which product from the Get Products list will receive the discount or free offer**.

There are three options available:

<figure><img src="https://2582339638-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FagGARFBou99u1ioIn7vL%2Fuploads%2FKLHVBbLqLpLuPthgDQWq%2Fgety.jpg?alt=media&#x26;token=06b5703c-edf3-4fb9-adbd-b705e77763b2" alt=""><figcaption></figcaption></figure>

* **Default:** Free/discount products will be selected in sequential order from the list.
* **Cheapest one:** The product with the lowest price among the items in the **"Get Products"** list will be selected for a free item or discount.
* **Most expensive one:** The product with the highest price among the items in the **"Get Products"** list will be selected for a free item or discount.

#### Example 1: Buy 2 Accessories, Get 1 Free Item

You are setting up a rule that allows customers to get 1 album, beanie, belt, or cap for free when they buy 2 items from the "Accessories" product category.

<figure><img src="https://2582339638-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FagGARFBou99u1ioIn7vL%2Fuploads%2FBSTEOlo3DK8OQxp5UA2K%2Fdefault.jpg?alt=media&#x26;token=7d48b1ad-3da7-4067-bc55-e85f5833a5f6" alt=""><figcaption><p>Example rule setting buy X get Y</p></figcaption></figure>

<figure><img src="https://2582339638-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FagGARFBou99u1ioIn7vL%2Fuploads%2F3Ylfu25ZUsYxbQb6viyV%2Fresult%20.jpg?alt=media&#x26;token=2b4aa49c-0ff0-49e7-afdf-a4571f10e5e7" alt=""><figcaption><p>Result</p></figcaption></figure>

**Note:** If you set a free item as the default, your customers can pick the free item they wish to receive (PRO version). You can check more details [here](https://docs.yaycommerce.com/yaypricing/features/product-pricing/buy-x-get-y/change-free-gifts).

<figure><img src="https://2582339638-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FagGARFBou99u1ioIn7vL%2Fuploads%2F2doRnpsXdrOYcnwpidaF%2Fchange%20free%20item.jpg?alt=media&#x26;token=a5c1894c-f728-4db0-b7f9-43617025c1ab" alt=""><figcaption></figcaption></figure>

#### Example 2: Buy 2 Accessories, Get 50% Off the Most Expensive Item

You are setting up a rule that allows customers to get 1 album, beanie, belt, or cap at a 50% discount on the most expensive item when they buy 2 items from the "Accessories" product category.

<figure><img src="https://2582339638-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FagGARFBou99u1ioIn7vL%2Fuploads%2FgVTvsd8AKqSCBGHVExD3%2Fxy%20rule.jpg?alt=media&#x26;token=423050af-30ee-4132-b383-a2c566a323ab" alt="Example rule setting buy X get Y 2"><figcaption><p>Example rule setting buy X get Y</p></figcaption></figure>

After adding **two accessories to the cart**, the system will automatically apply **50% off the most expensive product** among the eligible reward items.

<figure><img src="https://2582339638-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FagGARFBou99u1ioIn7vL%2Fuploads%2Fgo3PFp9aCBQtmmLGfXZb%2Fxy%20result.jpg?alt=media&#x26;token=9ea656d7-18ba-408c-8033-95bf30cfc86a" alt=""><figcaption><p>Result</p></figcaption></figure>
