# Customer tag discount

The Customer tag discount template applies an order discount for customers with a specific tag (or multiple tags) that you set.

## In this section

* [Customer tag discount example](/templates/customer-tag-discount.md)
* [Setting up a customer tag discount](#setting-up-a-customer-tag-discount)

***

## Customer tag discount example

In this example, customers who are logged into their customer account and who have a `wholesale` tag qualify for volume discounts on their order when their order has more than 4 items in the cart.&#x20;

#### The result:

Wholesale customers get a discounted 15% off their entire order. The total discount appears in the subtotal area of the cart before checkout.

### The function triggers

In this example, there are two triggers. The **AND** statement is required, meaning that both conditions must be met to trigger the discount.&#x20;

For the trigger conditions, the customer needs to have the `wholesale` tag and add more than 4 items to the cart.

***

## Setting up a customer tag discount

### Step 1 of 4: Campaign name

1. From the Function Junction dashboard, under **Quick start templates**, click **Customer Tag Discount**.
2. Under **Function name**, give your discount a unique name so you can identify it later.

{% hint style="info" %}
**Note:**

Function names (also called campaign names) need to be unique. Once created, they appear in the **Discounts** section of the Shopify admin.
{% endhint %}

### Step 2 of 4: Function trigger

In this example, there are two triggers. The **AND** statement is required meaning that both conditions must be met to trigger the discount. For the trigger conditions, the customer needs to have the "wholesale" tag and add more than 4 items to the cart.

1. Set up the conditions that customers need to meet to get the discount. In this example, the function needs two conditions, so click **Add a condition** and then enter the following conditions:&#x20;
   1. `If` `customer tags` `is any` `wholesale`
   2. `and` `cart items quantity` `is greater than` `4`
2. Click **Next**.

{% hint style="info" %}
**Note:**

This requires the customer to be logged in, have been tagged with `wholesale`, and be purchasing at least four items to qualify for the 15% discount.&#x20;
{% endhint %}

### Step 3 of 4: Function action

1. Set up the action (the discount) that is taken when the conditions you set are met.
   1. For this example, the action should be: **Percentage total discount.**
   2. Fill in the second text box with the number representing the discount amount you want to set up, then click **Next.** In this example, the discount here is **`15`**%.
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**.

In this example, the customer is rewarded with 15% off all items in the cart.

### Step 4 of 4: Discount details

1. Under **Discount type**, select if you want the discount to be **Automatic** or **With Discount Code**. In this example, the discount applies automatically.
   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).


---

# 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/templates/customer-tag-discount.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.
