# BOGO on Shopify with one discount code, cheapest item free

To run buy one, get one free with [OneCode: Stackable Discounts](https://apps.shopify.com/rm-combo-discounts), add one product discount to a code: 100% off a collection, with a quantity limit of 1 applied to the cheapest item first, and a condition that the cart has at least two items from that collection. When the customer has two items from the collection in the cart, the cheaper one becomes free. It works the same as an automatic discount. The customer adds both items to the cart; OneCode doesn't add the free one for them.

## Example

The code `SOCKSBOGO` covers the Socks collection. A customer adds Everyday socks at $12 and Wool socks at $15. The $12 pair is free, so the customer pays $15 plus shipping. One pair on its own is full price.

![SOCKSBOGO at checkout: the $12 Everyday socks are $0, the $15 Wool socks are full price, shipping is $6, and the total is $21](/images/checkout-bogo.png)

## Set it up

1. In OneCode, click **Create discount**. Choose **Discount code** and enter `SOCKSBOGO`, or choose **Automatic discount** and give it a **Title**.
2. Click **Add Discount Type**. Leave it as a **Product Discount**, and enter `100` in **Percentage**. Set **Target** to **Specific Collections** and pick the collection.
3. Click **Add quantity limit**. Enter `1` in **Quantity Limit** and keep **Apply discount to** on **Cheapest items first**.
4. Under **Per-Discount Conditions**, click **Add Condition**. Set **Field** to **Group Quantity**, **Operator** to **Greater than or equal to** and **Value** to `2`. Group Quantity counts only the items this discount type targets, so other products in the cart don't count.
5. Click **Save discount**.

![OneCode editor for code SOCKSBOGO: a 100% Product Discount on the Socks collection with Quantity Limit 1, Cheapest items first, and Group Quantity greater than or equal to 2](/images/editor-bogo.png)

## Variations

- **Buy 2, get 1 free:** set **Group Quantity** to at least `3`. With three items, the cheapest is free.
- **Buy one, get one 50% off:** enter `50` instead of `100`.
- **Most expensive item free:** set **Apply discount to** to **Most expensive items first**.
- **Free shipping with the BOGO:** add a **Shipping Discount** with **Free Shipping** to the same code. On its own, it makes shipping free on every order that uses the code. To give free shipping only when the BOGO applies, see [shipping discounts that follow another discount](/guides/shipping-when-discount-applies.md).
- **A different product free when they buy a specific one:** see [buy this, get that](/guides/discount-when-product-in-cart.md).

## How many items are free

The quantity limit counts once per order. With a limit of 1, a customer who adds four pairs still gets one pair free, not two. To make two items free when the customer buys four, set **Quantity Limit** to `2` and **Group Quantity** to at least `4`. That version gives nothing for two or three items, so pick the one that matches your offer.

Two of the same product count as two items, and one of them becomes free.

Shopify's own Buy X Get Y discount only discounts the item the customer gets, so free shipping or money off other items would need separate discounts. With OneCode they go on the same code.

OneCode costs $9.90 USD every 30 days after a 7-day free trial, billed by Shopify. [Install it from the Shopify App Store](https://apps.shopify.com/rm-combo-discounts).
