# How the rules are applied

<figure><img src="/files/TJrQv1GqJ28VccUHhp0O" alt=""><figcaption><p>Rule application setting</p></figcaption></figure>

#### All applicable rules

All applicable rules will be applied based on their position in order list (top-down)

*Example:* You have **2 product pricing rules**, and Beanie price is **$20** and **Album price** is **$15**

* Rule 1: Discount $5 when you buy Beanie product.
* Rule 2: Discount 20% when buying from 3 to 4 Beanie

The scenario is:

* When you buy first item which is **Beanie**, you have discount **$5** **( rule 1 is applied )** => Your cart subtotal is **$15**
* When you buy another **Beanie, rule 1** is applied => Your cart subtotal is **$30. $15 x2** of **Beanie**
* When you buy another **Beanie**, **rule 1 and rule 2** are applied => Beanie price now is **$12**. After rule 1, price is **$15,** then **rule 2** affected, price is **$12**. => Subtotal is **$12 \* 3 = $36**

#### **The first applicable rule:**

The first matched rule will take effect, and all other rules following it will be ignored.

#### **Minimum discount amount:**

Rule will make smallest amount of adjustment to take effect.

*Example*: Beanie price is **$20**

* Rule 1: Discount $5 when buying a Beanie
* Rule 2: Discount 10% when buying a Beanie.

\=> Rule 2 will take effect ( The smallest amount of adjustment is **$2** )

#### **Maximum discount amount:**

Rule is the opposite of Minimum discount amount, it will make highest amount of adjustment to take effect.

#### **To non discount product**

Rule will only apply to products that are not on sale or have no discounts applied to them.

*Example:*&#x20;

* Rule 1: Discount 10% when buying a Beanie
* Rule 2: Discount 50% when buying a Cap, Beanie

⇒ Rule 2 will only take effect for Cap.


---

# 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://docs.yaycommerce.com/yaypricing/global-settings/how-the-rules-are-applied.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.
