> ## Documentation Index
> Fetch the complete documentation index at: https://aiodapp.com/docs/llms.txt
> Use this file to discover all available pages before exploring further.

# Buy X Get Y (Discount)

> Template for discounting Y items when qualifying X items are purchased in AIOD.

Use **Buy X Get Y (Discount)** when a merchant wants customers to buy qualifying X items and receive a discount on Y items.

This template is inside the **Buy X Get Y (BOGO)** parent template. In Shopify admin, open **Apps** > **AIOD Discount & Gift** > **Discount Templates**, click **Create** on **Buy X Get Y (BOGO)**, then choose **Buy X Get Y (Discount)** on the **Select type** page.

The parent card says: "Buy one, get one or mix-and-match offers." The parent example shown in AIOD is "Buy any 3 shirts at \$99."

The inner template card says: "Discount Y when X items are purchased."

## When to use this template

Use this template for:

* Buy X, get Y at a percentage discount.
* Buy X, get Y at a fixed discount.
* Buy X, get Y at a fixed final price.
* Mix-and-match offers where qualifying X items and discounted Y items are different.
* BOGO discounts that need storefront widget messaging.

Use another BOGO template for fixed combined-price bundles or gift offers.

## Related BOGO templates

The **Buy X Get Y (BOGO)** parent opens three inner templates:

| Inner template                     | Use it for                                                               |
| ---------------------------------- | ------------------------------------------------------------------------ |
| **Buy X Get Y (Discount)**         | Discount selected Y items after the cart contains qualifying X items.    |
| **Buy X @ Fixed Price (Discount)** | Sell a required quantity of selected items for one combined fixed price. |
| **Buy X Get Y (Gift)**             | Add or offer gift variants after qualifying X items are in the cart.     |

## Form layout

The **Buy X Get Y (Discount)** form has two tabs:

* **Offer**
* **Widget**

It also includes **Use Custom Rule Builder**, and a top-level status dropdown.

### Status mode

The top-right status dropdown controls who can use or see the discount.

| Status       | Meaning                                                                                |
| ------------ | -------------------------------------------------------------------------------------- |
| **Live**     | The discount is active for customers.                                                  |
| **Testing**  | The discount is visible to the merchant for testing, but it is not live for customers. |
| **Deactive** | The discount is turned off.                                                            |

## Discount method

The **Discount Method** section supports:

* **Automatic discount**
* **Discount code**

For automatic discounts, AIOD shows a **Title** field and **Keep same as identifier**.

For discount codes, use the code fields when customers should enter a code at checkout.

## Select items (BX)

The **Select items (BX)** section defines what the customer must buy.

Observed default controls:

* **WHEN...** item type selector. The default shown is **Product**.
* Operator dropdown with **matches any of**, **matches all of**, and **does not match any of**.
* **Select products** picker.
* Empty state: **No products selected**.
* **How many items in X to unlock the Y discount?** quantity input. The default shown is `1`.
* **Add 'BX' item** to add another qualifying X group.

Use this section to model the "buy" side of the offer.

## Select items (GY)

The **Select items (GY)** section defines which items receive the discount.

AIOD describes this section as: "Choose items on which the customer will get the discount."

Target options:

| Target option                                          |
| ------------------------------------------------------ |
| **Apply Discount to Specific Collection**              |
| **Apply Discount to Specific Product**                 |
| **Apply Discount to Specific Variant**                 |
| **Apply Discount to Specific Variant whose Metafield** |

The default observed target was **Apply Discount to Specific Collection**, with **Select collections** and empty state **No collections selected**.

Other controls:

* **Number of items in Y to be discounted**.
* Helper text: customers must add this specific quantity of Y items to the cart for the discount to apply.
* **Discount Type**: **Percentage**, **Fixed Discount**, or **Fixed Final Price**.
* **Discount Value**.

Use this section to model the "get" side of the offer.

## Customer eligibility rules

Click **Add Rule** in **Customer Eligibility Rules (Optional)** to add customer eligibility rules for the offer.

Use this when the discount should only apply to selected customer groups or customer conditions.

## Sales channel

The **Sales channel** section controls where the discount applies.

Available channels:

* **Online store**
* **POS**

Both were checked by default in the observed form. When **POS** is enabled, **All locations** opens the location selector.

## Customer segment

The **Customer Segment** section restricts the discount to selected Shopify customer segments.

AIOD describes this section as: "This discount will be only applicable for customers in the selected segments."

### How should this discount combine with other discounts?

Read [**This discount can be combined with**](/docs/app/common-template-settings#this-discount-can-be-combined-with) for information about this.

## Active dates

The **Active Dates** section controls when the discount starts and ends.

Default fields:

* Start **Date**
* Start **Time**

Enable **Set end date** to reveal end date and time fields.

## Advanced settings

Click **Show** in **Advanced Settings (Optional)** to reveal **Discount Rules & Limits**.

Available controls:

| Setting                                                                                     | Behavior                                                                                                               |
| ------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------- |
| **Maximum Discount Amount**                                                                 | Limits the total discount amount.                                                                                      |
| **Apply discount on the LEAST expensive items**                                             | Applies the Y discount to the least expensive eligible items.                                                          |
| **Combo Discount**                                                                          | Treats the selected X and Y groups as a combo-style discount.                                                          |
| **Multiply based on condition**                                                             | Scales the offer. AIOD gives this example: buy 2 get 1, buy 4 get 2. This was checked by default in the observed form. |
| **Exclude already discounted items from discount (whose compare at price > selling price)** | Excludes already discounted items based on compare-at price.                                                           |
| **Purchase Type Eligibility**                                                               | Choose **One-time purchase**, **Subscription**, or **Both**. **Both** was selected by default.                         |
| **Limit the number of subscription cycles the discount will apply to**                      | Limits recurring subscription discount cycles.                                                                         |

## Show discounted price crossout

Read [**Show Discounted Price Crossout**](/docs/app/common-template-settings#show-discounted-price-crossout) for the shared storefront strikethrough pricing controls and placement steps.

## Widget tab

Use **Widget** to configure the storefront BXGY widget for this discount.

Default text fields:

| Field               | Observed default                                                 |
| ------------------- | ---------------------------------------------------------------- |
| **Title**           | `Add {{remaining_quantity}} more item & save {{discount_value}}` |
| **Unlocked title**  | `Offer unlocked - save {{discount_value}}`                       |
| **Sub text**        | Empty                                                            |
| **Button CTA text** | `Add`                                                            |

Click **View Available Variables** to see variables that can be inserted into widget text.

Style controls include:

* **Product layout**: **Horizontal** or **Vertical**.
* **Products visible at a time** slider. The observed value was `3`.
* **Show icon in CTA button**.
* **CTA button icon**.
* **Show currency prefix**.
* **Do not show discounted price**.
* **Show sold out products**.
* Background, border, title, and button color inputs.
* **Border radius** slider.
* Text-size sliders for title, subtitle, and button text.

### Where should the widget appear?

Read [**Where should the widget appear?**](/docs/app/common-template-settings#where-should-the-widget-appear) for information about this.

The preview area says to select BX and GY items in the **Offer** tab to see the preview UI.
