> For the complete documentation index, see [llms.txt](https://supercartapp.gitbook.io/supercart-docs/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://supercartapp.gitbook.io/supercart-docs/basics/cart-rules.md).

# Cart Rules

Cart rules are conditions applied to manage discounts and promotional campaigns in an e-commerce platform. They determine when a discount should be applied and can be configured to meet various group criteria, including:

* Line item rules (group 1)
  * Cart products condition (Yes / No)
* Cart Rules (group 2)

Businesses can effectively enhance customer engagement and boost sales through targeted offers by setting up cart rules.

### How to Create Cart Rules?

{% hint style="info" %}

#### ALL or ANY options

If you choose the **"ALL(yes)"** option, **all rules** must return **true** for the widget to be visible. \
If you select the **"ANY(no)"** option, only **one rule** must return **true** for the widget to be visible.
{% endhint %}

If **all cart products** is set to "Yes", then all products in cart must return true for each line rules.\
If all cart products is set to "No", then it's enough for one product to return true to pass the condition.

### Empty Rules

By default there are no cart rules.

{% hint style="warning" %}
When the cart rules are empty, the section will always be visible.
{% endhint %}

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

### Line Item rules

Adding **line item rules** will make the widget verify cart **line items** against your rules and display conditions.

<figure><img src="/files/8tfFyn7SOzG679yUQ637" alt=""><figcaption><p>A wide variety of cart rules</p></figcaption></figure>

You can use the **product selection** popup when you choose the **Handle** or **Product Title** option.

<figure><img src="/files/Fil06YZpOkQ4K5KDdaZg" alt=""><figcaption><p>Product Selection popup</p></figcaption></figure>

### Cart rules

Adding **line item rules** will make the widget verify **cart values** against your rules and display conditions.&#x20;

<figure><img src="/files/v2LZ9ziJ0vQUfM60AQex" alt=""><figcaption><p>Cart Rules</p></figcaption></figure>

### Example 1

If a customer's cart includes `chain-bracelet` as a line item, this rule will return true, making the Upsell visible.

<figure><img src="/files/mAI0VaeMwd7JVzromZU8" alt=""><figcaption><p>Line Item Rules Example</p></figcaption></figure>

### Example 2

**A.** Line Item rules (group)

If a customer's cart includes **`chain-bracelet`** as a **`line item`** <kbd>**AND**</kbd>\
If a customer's cart has a line item with **`vendor`** that contains **`"T-Shirt"`**

**B.** Cart Rules (group)

If the **`cart total`** is greater than **`$99`**

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

{% hint style="success" %}
All groups, **Line Item rules**, and **Cart rules** must be **valid** for the widget to be visible since the rules are set to "**All conditions.**"
{% endhint %}

<figure><img src="/files/XiaIACsz73ICVu0qqLpM" alt=""><figcaption><p>All conditions or Any Condition</p></figcaption></figure>

Upsell rules can significantly boost revenue and improve conversion rates by strategically offering customers additional products or services that complement their original purchase. By tailoring offers based on specific cart conditions, such as when the cart total exceeds a certain amount, businesses can encourage customers to buy more than they initially intended.&#x20;

This increases the average order value and enhances the shopping experience by showing relevant product recommendations that could fulfill unmet needs.&#x20;

Additionally, effective upsell strategies can lead to improved customer satisfaction and loyalty, as customers feel they are receiving added value in their purchases.


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## 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, and the optional `goal` query parameter:

```
GET https://supercartapp.gitbook.io/supercart-docs/basics/cart-rules.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

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.
