> ## Documentation Index
> Fetch the complete documentation index at: https://docsv4.mile.app/llms.txt
> Use this file to discover all available pages before exploring further.

# Advanced Discount

> Define discount rules on a bill that the field worker can apply, with caps and conditions.

**Advanced Discount** lets you define discount rules inside a bill. When creating or doing a task, the user picks at most one rule and the total updates by itself. The discount is checked and calculated again when the task is saved.

A switch on each bill turns it on. With the switch off, the bill works as before, with simple Cost and Discount add-ons.

<Note>
  Advanced Discount is available to internal accounts and is not available on a bill inside a Subpage.
</Note>

## Turning it on

Open the bill and scroll below **Items** and **Add-ons** to **Advanced Discount**.

<div align="center">
  <img src="https://mintcdn.com/mileappv4/Xul_B0hUk35UiMLk/images/v4/workflow/components/bill-advanced-discount.png?fit=max&auto=format&n=Xul_B0hUk35UiMLk&q=85&s=706f92669e5020eb88db254d3d233952" alt="Advanced Discount and discount rules" width="600" data-path="images/v4/workflow/components/bill-advanced-discount.png" />
</div>

1. **Advanced Discount**: turn it on. The simple **Discount** add-on type is then no longer offered; only **Cost** remains. If the bill already has Discount add-ons, you are asked to confirm and they are deleted; Cost add-ons are kept.
2. **Discount Rules**: the rules users can pick from.
3. **A rule**: its name, a summary (for example *Discount: 10% · Max: 50,000*), its type (**Percentage** or **Fixed Amount**) and a switch to turn it on or off. Use the arrows to reorder, the pencil to edit and the bin to delete (with a confirmation).
4. **Add a rule**: create a new rule.

The example has three rules: **Weekend 10%** (10%, at most 50,000), **Bulk Order** (30,000 off when there are at least 10 items and at least 200,000 in items) and **Old Promo**, which is switched off.

## A rule

Click **Add a rule**, or the pencil on a rule.

<div align="center">
  <img src="https://mintcdn.com/mileappv4/Xul_B0hUk35UiMLk/images/v4/workflow/components/bill-discount-rule.png?fit=max&auto=format&n=Xul_B0hUk35UiMLk&q=85&s=464d26f1c89346ee72ea2ba07f08dc24" alt="Edit Rule" width="600" data-path="images/v4/workflow/components/bill-discount-rule.png" />
</div>

| Field | Required | Meaning |
| - | - | - |
| **Rule name** | Yes | Shown to the user as the option. Kept on the task and in exports. Must be unique on the bill. |
| **Discount type** | Yes | **Percentage** or **Fixed Amount**. |
| **Percent off** / **Amount off** | Yes | For Percentage, a number from 0 to 100 (10 means 10%). For Fixed Amount, an amount above 0. |
| **Most it can take off** | No | A cap on the discount. Percentage rules only; leave empty for no cap. |
| **Minimum quantity** | No | The rule can be picked only when the bill has at least this many items in total. |
| **Minimum amount** | No | The rule can be picked only when the items add up to at least this amount. Costs are not counted. |
| **All of them / Any of them** | | With both conditions set: must both be met, or is one enough. |
| **Active** | Yes | Inactive rules are hidden from users and cannot be saved on a task. |

Leave both conditions empty to allow the rule on every bill.

<Note>
  The discount is calculated on the **items subtotal** only. Costs such as shipping are not part of the base, and do not count toward **Minimum amount**.
</Note>

### Examples

* **Weekend 10%, at most 50,000.** Items 200,000 → 10% = 20,000, under the cap. Discount **20,000**.
* **Same rule, bigger order.** Items 600,000 → 10% = 60,000, over the cap. Discount **50,000**.
* **Bulk Order, 30,000 fixed.** Discount **30,000** whatever the size, as long as the conditions are met, and never more than the items subtotal.

## Applying a discount

On a task with Advanced Discount, the bill has a **Discounts** section when at least one rule is active.

* **No discount** is always the starting choice; a discount applies only when the user picks one.
* Each rule shows the amount it would take off. A rule whose conditions are not met is greyed out with a hint such as *Min amount 200,000*, and cannot be picked.
* The amounts update as quantities change. If the picked rule stops qualifying, the bill goes back to **No discount** and the user is told.
* The picked discount is saved with the task, and is restored when the task is opened again, as long as the rule still exists, is active and still qualifies.

## Bulk create and import

* In **Bulk** task creation, each bill row has its own discount choice.
* In a spreadsheet import, add a column named `{Bill title}.discount` and write the exact rule name in each row. A blank, unknown, inactive or non-qualifying name gives no discount for that row.

## Always checked when saving

Every discount is calculated again when a task is saved, whether it was created alone, in bulk or by import. The rule must exist, be active and qualify for the items, and the amount must match. The stored amount is always the recalculated one.

In exports, a bill with a discount shows a **Discount** row named after the rule, with a negative amount.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.