# A different Shopify discount for subscription and one-time purchases

To give subscription items one discount and one-time purchases another with the same code, use [OneCode: Stackable Discounts](https://apps.shopify.com/rm-combo-discounts) and add two product discounts to the code. Give one the Per-Discount Condition **Item has subscription** set to **Yes**, and the other **Item has subscription** set to **No**. OneCode checks each item in the cart, so a subscription and a one-time purchase in the same cart each get their own discount.

Example: the code SUBSAVE gives 15% off subscription items, 10% off one-time items, and free shipping. A customer subscribes to a $30 monthly coffee and buys a $20 mug once:

- The coffee is a subscription item, so it gets 15% off, $4.50. It costs $25.50.
- The mug is a one-time purchase, so it gets 10% off, $2. It costs $18.
- The subtotal is $43.50, and shipping is free.

![SUBSAVE at checkout. The $30 coffee subscription is $25.50, the $20 mug is $18, shipping is free, and the total is USD $43.50.](/images/checkout-subsave.png)

**Item has subscription** works as a filter, not a pass-or-fail rule. With **Yes**, subscription items get that discount and one-time items in the same cart don't. With **No**, it's the other way round. Each item matches exactly one of the two discounts, so nothing is left out.

## Set it up

1. In OneCode, click **Create discount**, keep **Discount code**, and enter `SUBSAVE`.
2. Click **Add Discount Type**. Keep **Discount Type** on **Product Discount** and **Value Type** on **Percentage**, and enter `15` in **Percentage**. Keep **Target** as **All Products**, or pick the collections you sell on subscription.
3. Under **Per-Discount Conditions** on that discount, click **Add Condition**. Set **Field** to **Item has subscription** and **Value** to **Yes**.
4. Click **Add Discount Type** again and enter `10` in **Percentage**, with the same **Target**.
5. Under **Per-Discount Conditions** on this second discount, click **Add Condition**. Set **Field** to **Item has subscription** and **Value** to **No**.
6. Click **Add Discount Type**, set **Discount Type** to **Shipping Discount**, and keep **Free Shipping**.
7. Click **Save discount**.

![The OneCode editor for the code SUBSAVE: a 15% Product Discount on All Products with the Per-Discount Condition Item has subscription set to Yes, a 10% Product Discount with Item has subscription set to No, and a Free Shipping discount on all rates](/images/editor-subsave.png)

A [Shopify discount code](https://help.shopify.com/en/manual/discounts/discount-methods/discount-codes) holds one kind of discount, so with Shopify's own codes this offer would take more than one code. In OneCode it's one code with three parts.

## Choose how many subscription orders get it

A code applies to the first subscription order only, unless you change it. To keep the 15% for the first few orders, use the **Subscription recurring limit** card near the bottom of the code's settings page. It applies to the whole code:

1. Tick **Limit discount to specific recurring cycles**.
2. In **Number of cycles**, enter how many subscription orders get the discount. `3` covers the first order and the next two renewals. `1` covers the first order only. `0` covers every renewal.
3. Click **Save discount**.

With `3`, the customer above pays $25.50 for the coffee on each of their first three orders, and $30 from the fourth order on.

![The Subscription recurring limit card, with Limit discount to specific recurring cycles ticked and Number of cycles set to 3](/images/subscription-limit.png)

For more on renewals, see [subscription discounts for the first few orders](/guides/subscription-discounts.md).

## Other ways to build it

- **10% for everything, 15% for subscriptions:** add a 10% product discount with no condition, and a 15% product discount with **Item has subscription** set to **Yes**. Subscription items qualify for both and get the one that saves more, 15%. They never get 25%.
- **Nothing off subscriptions:** add only the one-time discount with **Item has subscription** set to **No** under **Per-Discount Conditions**.

![Per-Discount Conditions on a product discount with Item has subscription set to No](/images/condition-subscription-no.png)

## Things to check before you launch

- You need a [subscription app](https://help.shopify.com/en/manual/products/purchase-options/subscriptions/shopify-subscriptions) to sell subscriptions. OneCode decides which items and orders get the discount, and the subscription app creates the orders.
- Preorders sold with a Shopify purchase option count as subscription items for **Item has subscription**. If you sell preorders that way, they get the subscription discount.
- **Item has subscription** is a Per-Discount Condition on product discounts. It isn't available as a Global Condition.
- If your subscription app shows the one-time price as the compare-at price, subscription items count as sale items. That only matters if you add a sale item rule. See [20% off full price and 10% off sale items](/guides/sale-items.md).
- A subscription with many payments counts as one use toward **Maximum discount uses**.

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