> ## 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 (Gift)

> Template for adding or offering gift variants when qualifying X items are purchased in AIOD.

Use **Buy X Get Y (Gift)** when a merchant wants buying qualifying X items to unlock gift variants.

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 (Gift)** 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: "Add a gift item when X items are purchased."

## When to use this template

Use this template for:

* Buy selected products and get a free gift.
* Buy a required quantity and unlock a discounted gift.
* Let customers claim a gift from a widget after they qualify.
* Auto-add a gift to the cart after the cart qualifies.

Use another BOGO template when the offer discounts Y items or sells a selected quantity at one fixed combined price.

## 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.     |

## Theme extension requirement

AIOD can show this warning: **Required: Theme Extension Should Be Enabled**.

The warning says **Activate theme extension** automatically enables the **Latest Widget Manager** extension. The merchant must click **Save** in the theme editor after activation.

Use this section when a merchant asks why the BOGO gift widget or gift flow is not appearing on the storefront.

### 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 observed default **Discount ID** placeholder was `eg: WELCOME GIFT`.

The **Discount Method** section supports:

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

The default **Automatic discount** title was `Free Gift`.

Choose **Discount code** when customers should enter a code to unlock the gift.

## When to add the gift

The **When to add the gift** section defines qualifying X items.

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**.
* **Minimum Quantity of ANY above selected products in cart**. The default shown is `1`.
* **Calculate subtotal before discount**.
* **AND condition**.
* **OR condition**.

Click **Advanced Settings** inside this section to reveal more qualification controls.

Advanced qualification controls:

| Setting                                                   | Behavior                                                                        |
| --------------------------------------------------------- | ------------------------------------------------------------------------------- |
| **Quantity scope**                                        | Choose how qualifying quantities are counted.                                   |
| **Across all selected items**                             | Counts total quantity across all selected items. This was selected by default.  |
| **Same variant**                                          | Requires one variant to individually meet the quantity requirement.             |
| **Same product**                                          | Allows variants of the same product to combine toward the quantity requirement. |
| **Purchase Type of each above selected items in cart**    | Choose **Any**, **One Time**, or **Subscription**.                              |
| **Minimum Cart Subtotal of above selected items in cart** | Sets a minimum subtotal for qualifying X items. `0` means no minimum subtotal.  |
| **Maximum Cart Subtotal of above selected items in cart** | Sets a maximum subtotal for qualifying X items. `0` means no maximum limit.     |
| **Calculate subtotal before discount**                    | Calculates subtotal from item prices before discounts are applied.              |

## Select gift items

The **Select Gift Items** section chooses which variants can be added as gifts.

AIOD notes that variants should be active, in stock, and have a price greater than `0`.

Controls:

* **Select variants**.
* Empty state: **No variants selected**.
* **Quantity of each gift to be added**. The default shown is `1`.
* **Multiply Gift Quantity based on "When" rules**.

AIOD gives this example for multiplying gift quantity: buy 2 get 1 gift, buy 4 get 2 gifts, and so on.

## Gift pricing

Choose how gift items are priced.

| Option                          | Behavior                                                                          |
| ------------------------------- | --------------------------------------------------------------------------------- |
| **Offer as free gift**          | Adds or offers the selected gift variants for free. This was selected by default. |
| **Offer at a discounted price** | Reveals **Discount Percentage %**. The observed default was `50`.                 |

Use **Offer at a discounted price** when the gift should be discounted instead of free.

## How to add the gift

The **How to add the gift** section controls whether AIOD adds the gift automatically or asks the customer to claim it.

| Method        | Behavior                                                                                      |
| ------------- | --------------------------------------------------------------------------------------------- |
| **Automatic** | Automatically adds the gift to the cart when the rules are met. This was selected by default. |
| **Manual**    | Lets customers pick or claim the gift from the widget.                                        |

When **Automatic** is selected, AIOD shows **Allow the user to remove the gift**.

AIOD explains that if customers remove the gift manually, the gift cannot be added automatically again. Customers must use the widget claim button to add the gift again.

### 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 gift offer starts and ends.

Default fields:

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

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

### 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.

## Widget settings

The **Widget Settings** section includes:

* **Use this feature Only As Widget**.
* Helper text: the discount will not be created, only the widget will be created.
* **Gift Widget Preview**.
* **Customize Banner**.

If no gift item is selected, the preview says to select gift items to preview the gift banner.

## Gift messages settings

The **Gift Messages Settings** section configures popup messages shown when gifts are added to or removed from the cart.

Click **Go to Settings** to edit those messages.
