# Take a Shopify discount off the compare-at price, not the sale price

To make a code take its percentage off the original price instead of the sale price, use [OneCode: Stackable Discounts](https://apps.shopify.com/rm-combo-discounts) and give the product discount the sale item rule **Discount from the compare-at price**. With 20% off, each sale item ends at 20% off its compare-at price, or keeps its sale price if that is already lower. The code and the sale don't add up: each item costs whichever is lower, its sale price or 20% off its original price.

Without the rule, the code comes off the current price. A 20% code on an item reduced from $100 to $85 takes it to $68, which is 32% off the original. With the rule, the same item ends at $80.

A sale item is any item whose compare-at price is higher than its price. OneCode checks this for each item when the customer checks out, so you don't keep a list of sale products.

## What a 20% code does to a cart

A cart with three items:

- A jacket reduced from $100 to $85. 20% off $100 is $80, so it ends at $80. The customer saves $5.
- A sweater reduced from $100 to $70. Its sale price is already below $80, so it stays at $70. The customer saves nothing on it.
- A $40 T-shirt at full price, with no compare-at price. It gets the normal 20% off, $8, so it costs $32.

The subtotal is $182 instead of $195, a saving of $13. With no sale item rule, the same code would take the cart to $156.

![FOUNDVIP26 at checkout. The Field jacket, on sale at $85 (was $100), is $80, the Knit sweater, on sale at $70 (was $100), stays $70, and the $40 Classic cotton tee is $32. The subtotal is $182, shipping is $8 and the total is USD $190.00.](/images/checkout-compare-at.png)

![The OneCode editor for the code FOUNDVIP26: a Product Discount of 20% on All Products, with the Sale items rule set to Discount from the compare-at price](/images/editor-sale-items.png)

## Set it up

1. In OneCode, click **Create discount**. Keep **Discount code** and enter your code, or choose **Automatic discount** and give it a **Title**.
2. Click **Add Discount Type**. Keep **Discount Type** on **Product Discount** and **Value Type** on **Percentage**, and enter `20` in **Percentage**.
3. Keep **Applies to** as **All Products**, or choose **Specific Collections** and pick the collections you want.
4. Click **More settings** and set **Sale items** to **Discount from the compare-at price**.
5. Click **Save discount**.

![The Sale items section with Discount from the compare-at price selected, described as Sale items get this % off their compare-at price](/images/sale-items-compare-at.png)

To remove the rule later, click the red trash icon next to **Sale items**.

## What checkout shows

Checkout shows the discount as "20% OFF", or your code or discount title, next to each discounted item. The amount is the saving from the sale price, not from the original price: $5 on the $85 jacket, and $8 on the full-price T-shirt.

If every item in the cart is already reduced by more than 20%, the code gives nothing off, so checkout may say the code can't be applied. Mention on your sale banner that the code gives "20% off the original price", so customers know what to expect.

## Things to check before you launch

- **Discount from the compare-at price** is only for **Percentage** discounts. A **Fixed Amount Off** discount always comes off the current price.
- Make sure your sale prices use compare-at prices. An item with no compare-at price, or one that isn't higher than its price, gets the normal 20% off its current price.
- The rule is set on each product discount. If your code has two product discounts, add the rule to each one that should use it.
- Sale item rules are only on product discounts. An order discount treats sale items like any other item.
- Subscription items follow the same rule. If your subscription app shows the one-time price as the compare-at price, subscriptions count as on sale too. To leave them out, add a Per-Discount Condition with **Item has subscription** set to **No**.

## Other ways to treat sale items

The **Sale items** rule has three options. **Discount the sale price (default)** takes the percentage off the current price, the same as no rule. **Exclude sale items** gives sale items nothing from that discount.

To give full-price items one percentage and sale items a smaller one, for example 20% and 10%, see [20% off full price and 10% off sale items](/guides/sale-items.md). For a creator code that runs during a store-wide sale, see [an influencer code during a sale](/guides/influencer-code-during-a-sale.md).

## Add free shipping to the same code

Click **Add Discount Type**, set **Discount Type** to **Shipping Discount**, and keep **Free Shipping**. Customers get 20% off the original price and free shipping from one code. 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 the free shipping would need a second code. See [a discount code with free shipping](/guides/discount-code-with-free-shipping.md).

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