> For the complete documentation index, see [llms.txt](https://support.functionjunctionapp.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://support.functionjunctionapp.com/templates/product-discount.md).

# Product discount

You can build campaigns to reward customers for items added to the cart. You can discount items in the cart by a monetary amount or percentage.

The Product discount template applies a discount to each individual item in the cart that qualifies for a discount.

## In this section

* [Product discount example](/templates/product-discount.md)
* [Setting up a product discount](#setting-up-a-product-discount)

***

## Product discount example

In this Product discount function example, the store is rewarding customers with **50%** off each item if the cart subtotal is greater than **$50**.

#### The result:

The customer receives the discounted amount for each individual item in the cart with a custom message:

<figure><img src="/files/Gcb7yBHUPjqOT9tJv33o" alt=""><figcaption></figcaption></figure>

### The function trigger

In this example, there is one trigger condition. The cart subtotal must be over $50 for the discount to apply. The discount is applied to each item by the percent value:

<figure><img src="/files/pjEPaR2uVz6GmExqlddy" alt=""><figcaption></figcaption></figure>

***

## Setting up a product discount

### Step 1 of 4: Campaign name

1. From the Function Junction dashboard, under **Quick start templates**, click **Product 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

1. Set up the conditions that customers need to meet to get the discount.
   1. The criteria for this example should be based on **cart subtotal.**
2. Optional: Click **Add a condition** to add an additional condition, if you want customers to meet more than one.
3. Click **Next**.

{% hint style="info" %}
**Note:**&#x20;

Additional conditions can be combined with AND/OR options.
{% 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 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.** In this example, the discount is 50%.
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: 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).

If you added a **Discount message**, then it appears in the cart.

<figure><img src="/files/DmWOEMrcbem8wh4UbqJC" alt=""><figcaption></figcaption></figure>

If left blank, the **Campaign Name** is added to the cart message.
