# Sending orders to departments (https://docs.treema.ai/en/docs/storefronts/catalog/routing)

How every ordered item becomes a task for the right department — setting the department, priority and tags on a service or a group, what is inherited, and the warnings that tell you a service reaches nobody.

Every item a guest orders becomes a task in [Tasks](https://docs.treema.ai/en/docs/tasks/), assigned to one
[department](https://docs.treema.ai/en/docs/settings/user-groups/) — Spa, Housekeeping, Front desk. You decide once which
department gets which service. After that each order reaches the people who do the work, and the
order's status follows their progress — see [Orders](https://docs.treema.ai/en/docs/storefronts/orders/).

## What the department receives [#what-the-department-receives]

One task for each ordered item:

* The title is the item, the quantity and the guest's name: "Airport transfer ×2 · Anna Silva".
* The assignee is the department.
* The priority and the tags are the ones set for the service. With no priority set, it is
  **Medium**.
* The due date is the date and time the guest chose in the service's
  [schedule](https://docs.treema.ai/en/docs/storefronts/availability/). Without a chosen time the task has no due date.
* The task belongs to the storefront's property, or to HQ for an HQ storefront.

The task also shows the guest's order: the contacts, the item, the answers to your questions and
the comment. See [the task card](https://docs.treema.ai/en/docs/tasks/task/).

Everyone in the department gets a push notification and an entry **New task for your department**
in [Notifications](https://docs.treema.ai/en/docs/tasks/notifications/), with **Guest order** as the author. Only people
who can see tasks in that property are notified, so check the people in the department against
their roles.

## Where to set it [#where-to-set-it]

Select a service or a group in the editor. On its **General** tab, **Task routing** has three
fields, saved with the rest of the card by **Save changes**.

![Screenshot: storefronts/service-routing](https://docs.treema.ai/screenshots/en/storefronts/service-routing.png)

1. Task routing on a service — Department, Task priority and Task tags, each with a hint naming the group an inherited value comes from

* **Department** — on a group it is called **Category department**. A property's storefront offers
  the departments of that property and of HQ; an HQ storefront offers HQ departments only.
* **Task priority** — **Low**, **Medium**, **High** or **Urgent**.
* **Task tags** — from the tags available in the storefront's property.

A field left empty takes its value from the group above. To clear a department or a priority,
select the chosen one again. Anyone whose role includes **Changes the storefront** can set routing.

## Set it once on a group [#set-it-once-on-a-group]

A group's settings apply to everything inside it that has none of its own, at any depth. Set
**Category department** to Spa on the Spa & wellness group, and every treatment inside it goes to
Spa. Set a department on a single service only where it is the exception.

* Each field is inherited separately: a service can take its department from its group and have a
  priority of its own.
* Tags are inherited as a whole list. A service with tags of its own uses only those, not its own
  plus its group's.
* With nothing set on the card or above it, the task has no department, **Medium** priority and no
  tags.

## When a service reaches nobody [#when-a-service-reaches-nobody]

The editor warns you and does not stop you. A service is flagged when its orders would reach
nobody:

| Reason                        | What it means                                                            |
| ----------------------------- | ------------------------------------------------------------------------ |
| **No department**             | No department is set on the service or on a group above it.              |
| **Department unavailable**    | The department belongs to a property this storefront is not attached to. |
| **Department has no members** | The department is set, but nobody is in it.                              |

The warning is shown in **Task routing**, next to the service in the list of cards, and in a banner
at the top of **Storefront settings**, which lists every such service with its reason.

A storefront with such services can still be published, and guests can order them: the order
arrives in **Orders** as usual. Its task is created with no assignee — or assigned to the empty
department — so nobody is notified.

## When a change takes effect [#when-a-change-takes-effect]

Routing applies to orders placed after you save it. Tasks that already exist keep their department;
to move one, reassign it in Tasks.

Deleting a department removes it from these settings, and the services that used it take what the
group above them sets. Moving a service into another group changes what it inherits at once.
