> For the complete documentation index, see [llms.txt](https://docs.spiroq.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.spiroq.com/en/hub-screens/hub/cenove-balicky/cenova-pravidla.md).

# Pricing rules

**Price advantages → Pricing rules** is available from the **Pro** plan.

A rule is a discount on a unit of a product in a slot, typically in the last days before the best-before date. The HUB recalculates the unit price and the machine takes it over. On the card, the customer sees the promotional price and how many units are still left at that price — from the front of the slot.

A rule applies to products in a group, not to one machine. On a product, the rules are on the **Pricing rules** tab in the [product detail](/en/hub-screens/hub/produkty/detail-produktu.md).

## Group and rule

A **Group** says which products the discounts apply to. By itself it does not change the price.

A **Rule** is one discount inside the group: in which window of days to expiration it applies, and by how much it lowers the price. A group can have several of them, for example a different discount 7 days before the best-before date and another on the last day.

Rules are evaluated by priority and expiry window. A lower priority number is earlier. When more than one rule fits a unit, the discounts stack one after another. A turned-off group is not used.

## Group fields

**Create group** opens the form. The same fields are in editing.

| Field       | Required | Meaning                                                          |
| ----------- | -------- | ---------------------------------------------------------------- |
| Name        | yes      | Name of the group in the list.                                   |
| Priority    | yes      | Order of the groups. A lower number is evaluated earlier.        |
| Description | no       | A note for you.                                                  |
| Products    | no       | Which products the group's rules apply to.                       |
| Active      | no       | The default is on. A turned-off group does not change the price. |

## Rule fields

In the group detail there is **Add rule**.

| Field              | Required | Meaning                                                                                                 |
| ------------------ | -------- | ------------------------------------------------------------------------------------------------------- |
| Min days to expire | no       | From how many days to the best-before date the rule applies.                                            |
| Max days to expire | no       | Until how many days to the best-before date the rule applies.                                           |
| Action type        | no       | **Percent discount** or **Fixed price (cents)**.                                                        |
| Value              | yes      | For percent, **30** is a 30% discount. For a fixed price, the amount is in cents: **2500** = 25.00 CZK. |
| Priority           | yes      | Order of rules inside the groups. A lower number is earlier.                                            |
| Valid from         | no       | From when the rule applies. Empty = no start.                                                           |
| Valid to           | no       | Until when the rule applies. Empty = no end.                                                            |

## When the price reaches the machine

Saving a group or a rule does not change the price on the machine by itself. The Hub recalculates promotional prices and sends them:

* once a day,
* with **Apply rule** on the rule in the group detail — immediately,
* when the machine connects,
* after **Change price on all machines** in the [product detail](/en/hub-screens/hub/produkty/detail-produktu.md).

A unit without a best-before date stays at the catalog price. When the plan drops below **Pro**, the machines return to the catalog price. The rules stay in the HUB and are used again when the plan returns.
