Some customers and countries only accept goods with a minimum remaining shelf life, for example nine months for deliveries to Switzerland. Under **Best-before rules** (*MHD-Regeln*) you, as the logistician, store such requirements. When a picking list is created for an order that a rule matches, X-Sitter only plans goods whose best-before date still runs at least the given number of days on the day of the pick. Goods without a best-before date are not affected.

!!!
Not the same as the warehouse setting **Minimum remaining shelf life (days)** (*Mindestrestlaufzeit (Tage)*) in the [warehouse settings](/warehouse-setup/warehouse-settings.md): that setting moves short-dated stock to blocked stock for all orders. Best-before rules block nothing – they only decide which goods may go to a particular order.
!!!

![Screenshot: Page "Best-before rules" with the explanation, the button "New best-before rule" and three rules with client, delivery country, platform, days, earliest best-before date today and status](/warehouse-setup/images/shelf-life-rules-list.png)

## Before you start

- Your user needs the permission **Best-before rules** (*MHD-Regeln (Mindestrestlaufzeit je Auftrag)*) in the WMS area: **Overview** (*Übersicht*) to see the list, **Create / Edit** (*Erstellen / Bearbeiten*) for the form and **Delete** (*Löschen*) to remove rules. Ask your administrator.
- The rules only work for goods whose best-before date was recorded at [putaway](/inbound/putaway.md).

## Step by step

1. Open **WMS › Settings › Best-before rules** (*WMS › Einstellungen › MHD-Regeln*).
2. Click **New best-before rule** (*Neue MHD-Regel*). The form **Best-before rule** (*MHD-Regel*) opens.
3. Enter a **Name** (*Name*), e.g. "Switzerland min. 9 months", and the **Minimum remaining shelf life (days)** (*Mindestrestlaufzeit (Tage)*). Nine months are about 270 days.
4. Under **Which orders does the rule apply to?** (*Für welche Aufträge gilt die Regel?*) narrow the rule down with **Client** (*Mandant*), **Delivery country** (*Lieferland*) and **Platform** (*Plattform*). Every criterion is optional – an empty criterion applies to all.
5. Leave the **Status** (*Status*) on **active** (*aktiv*), or choose **inactive** (*inaktiv*) to prepare a rule without using it yet.
6. Click **Save** (*Speichern*). You see "The best-before rule has been saved" (*Die MHD-Regel wurde gespeichert*) and are back in the list.

![Screenshot: Form "Best-before rule" with name "Northern Light on Amazon UK", 180 days, client Northern Light Cosmetics Ltd., all countries, platform "Amazon UK" and status active](/warehouse-setup/images/shelf-life-rules-form.png)

To change a rule, click the green pencil button in its row. To remove it, click the red bin button and confirm **Delete best-before rule?** (*MHD-Regel löschen?*) with **Delete** (*Löschen*). You see "The best-before rule has been deleted" (*Die MHD-Regel wurde gelöscht*). The buttons only appear with the matching permission.

## The list

| Column | Meaning |
|---|---|
| **Name** (*Name*) | Name of the rule. |
| **Client** (*Mandant*) | Client the rule is limited to, otherwise "all" (*alle*). |
| **Delivery country** (*Lieferland*) | Country with ISO code, otherwise "all". |
| **Platform** (*Plattform*) | Platform of the order, otherwise "all". |
| **Minimum remaining shelf life (days)** (*Mindestrestlaufzeit (Tage)*) | Required remaining days on the day of the pick. |
| **Earliest best-before date today** (*Frühestes MHD heute*) | Today plus the days: goods picked today for such an order must have at least this best-before date. |
| **Status** (*Status*) | **active** or **inactive**. Inactive rules are ignored. |

## Fields and options

| Field | Meaning | Required |
|---|---|---|
| **Name** (*Name*) | Name of the rule, up to 128 characters. | yes |
| **Minimum remaining shelf life (days)** (*Mindestrestlaufzeit (Tage)*) | Number of days the best-before date must still run on the day of the pick, at least 1. | yes |
| **Client** (*Mandant*) | Only orders of this client. The list shows your active clients and your own company. "all clients" (*alle Mandanten*) = no limit. | no |
| **Delivery country** (*Lieferland*) | Only orders with this country in the delivery address. "All countries" (*alle Länder*) = no limit. | no |
| **Platform** (*Plattform*) | Only orders from this shop or marketplace, written exactly as the platform appears in the order (upper and lower case do not matter). The field suggests platforms from the orders of the last 180 days. Empty = all platforms. | no |
| **Status** (*Status*) | **active** or **inactive**. | no |

## How the rules work

- A rule matches an order when all filled criteria match: the client of the order, the country of the delivery address (as ISO code or country name) and the platform of the order.
- If several rules match, the strictest one applies – the one with the most days.
- When the [picking list is created](/outbound/create-picklist.md), goods below the minimum are treated like expired goods for this order. X-Sitter takes the oldest best-before date that still meets the rule. Orders without a matching rule keep getting the oldest date as usual.
- The [shortage dialog](/outbound/create-picklist.md#shortage-dialog) only counts goods that meet the rule. A position may therefore be short although there is enough stock with an earlier best-before date.
- The minimum is stored on each position of the picking list. During [picking](/outbound/picking.md), the best-before date of the position shows "order requires at least …" (*Auftrag verlangt mind. …*), and the check is repeated on the day of the pick.
- A changed or new rule applies to picking lists created afterwards. Positions that are already planned keep their stored minimum.

## Troubleshooting

| Message | Cause | Solution |
|---|---|---|
| Please enter a name for the rule (*Bitte gib einen Namen für die Regel ein*) | The name is empty. | Enter a name. |
| Please enter a minimum remaining shelf life of at least one day (*Bitte gib eine Mindestrestlaufzeit von mindestens einem Tag ein*) | The number of days is empty or 0. | Enter at least 1. |
| Please choose a valid delivery country (*Bitte wähle ein gültiges Lieferland*) | The country is not a valid two-letter code. | Choose a country from the list. |
| The best-before rule was not found (*Die MHD-Regel wurde nicht gefunden*) | The rule was deleted in the meantime. | Open the list again. |
| Best-before date … is below the minimum remaining shelf life of … days for this order (earliest date …) – these goods must not be picked for this order. (*MHD … unterschreitet die Mindestrestlaufzeit von … Tagen für diesen Auftrag (frühestes MHD …) – diese Ware darf für den Auftrag nicht gepickt werden.*) | When picking, the goods on the storage place are too short-dated for this order. If there are some suitable items left, the message adds how many. | Take goods with a later best-before date, e.g. after a [relocation](/stock/relocation.md). Check the dates in the [stock overview](/stock/stock-overview.md). |
| Dialog **Stock shortage detected** (*Fehlbestand erkannt*) although there is stock | Only part of the stock meets the rule of the order. | Put away goods with a later best-before date, or check whether the rule is too strict. |
