# Conditional discounts

With conditional discounts, you can set up different [types of discounts](/function-types/discounts.md#discount-function-types), such as fixed discounts (like $5 off) or percentage discounts (like 5% off) off items or the total cart amount.

You can set multiple types of conditions, which provides more flexibility in how you set up the discount rules.

You can create conditional discounts to target specific customer actions or groups. For example:

* **Spend threshold:** Offer $5 off when a customer spends $50 or more.
* **Collection-based:** Apply 15% off items in a specific collection, such as clearance products.
* **Customer segment:** Give wholesale customers (tagged with `wholesale`) 20% off their orders.

These types of discounts help you tailor promotions to different shopping behaviors or customer groups.

## In this section:

* [Creating a conditional discount](#creating-a-conditional-discount)
  * [Example of a conditional discount](#example-of-a-conditional-discount)

***

## Creating a conditional discount

### Step 1 of 4:

1. From the Function Junction dashboard, click **Create new campaign**.
2. Under **Create campaign**, click **Start from scratch.**
3. Beside **Conditional Discount**, click **Continue**.
4. Under **Function name**, give your discount a unique name so you can identify it later, then click **Next**.

### Step 2 of 4:

1. Set up the conditions that customers need to meet to get the discount.
   1. Criteria can be based on: **customer total spend, customer tags, customer orders count, cart subtotal, cart items quantity, cart has items,** and **cart has no items**. Each condition has specific rules that you need to set up.
2. Optional: Click **Add a condition** to add an additional condition, if you want customers to meet more than one.
3. Click **Next**.

### Step 3 of 4:

1. Set up the action (the discount) that is taken when the conditions you set are met.
   1. The discount types you can choose from the drop-down menu are: **Percentage discount per item**, **percentage total discount, fixed total discount**, or **fixed discount per item**.
   2. Fill in the second text box with the number representing the discount amount you want to set up, then click **Next.**
2. Optional: Under **Filter**, add a filter. You can choose to set the discount for only specific products. This can be based on: **product/variant, product tag, collection, vendor, type,** or **on sale**. Each filter condition you can choose has specific rules that you need to set up.&#x20;
3. When you're done, click **Next**.

### Step 4 of 4:

1. Under **Discount type**, select if you want the discount to be **Automatic** or **With Discount Code**.
   1. **Automatic**: Under **Discount message**, if you select **Yes**, then enter the discount message in the field provided below.
   2. **With Discount Code**: Enter the discount code that you want customers to enter at checkout.
2. Under **Combinations**, if you want this discount to be combined with other discounts, then click **Yes**, and check which types of discounts that you want it to be combinable with.&#x20;
3. When you're done, click **Publish**.

When your discount is published, if you want to advertise it, then you can [publish a widget to your store](/creating-and-publishing.md#step-2-publishing-a-widget-to-your-storefront).

***

### Example of a conditional discount

In this example, Ramesh has a sporting goods shop.&#x20;

He wants flexibility in creating a 20% off discount code because he has a few conditions that need to be met:

* the cart subtotal needs to be over $50,
* there needs to be at least 3 items in the cart,
* the items can't be on sale.<br>

In this case, he'd choose a conditional discount and do the following:&#x20;

* **Function name**: In this case, Ramesh would give his conditional discount a name like `20% off $50 carts` so that he can identify it later.
* **Conditions**: In step 2, because he wants this to be exclusive to carts with at least $50 worth of product and 3 items, he needs to add two conditions:
  * `if` `cart subtotal` `is greater than` `$50`
  * `and` `cart items quantity` `is greater than or equal to` `3`
* **The action (ie discount)**: In step 3, Ramesh would enter the discount action as `then` `percentage total discount` `is` `20%`.
* **Filter**: In step 3, because Ramesh wants to apply this only to products that aren't on sale, he would select **Specific products**, then `on sale` `false`.
* **Discount method**: In step 4, Ramesh would set the **Discount type** to **With Discount Code.** He is going to send out an email to customers, and also add a [widget](/creating-and-publishing.md#step-2-publishing-a-widget-to-your-storefront) to the store to advertise the sale, so he sets the **Discount message** to `20% OFF carts over $50 (with at least 3 items)!`


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://support.functionjunctionapp.com/function-types/discounts/conditional-discounts.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
