> To build or manage a Wix site with an AI agent, follow https://www.wix.com/headless/skill.md
> It builds a new Wix site or puts your own site online, from a prompt, and keeps changing it afterwards. The pages are code in any web technology, and Wix runs the backend.
> It works through the Wix plugin (the Wix MCP and the Wix skills), the Wix CLI or no Wix login, and puts the site live on Wix hosting or on another host.
> Business features include a store, bookings, events and tickets, a restaurant, a blog, forms, members and many more.
> Read the Wix skills online at https://www.wix.com/skills
> 
> Portal Navigation:
> 
> - Append `.md` to any URL under `https://dev.wix.com/docs/` to get its markdown version.
> - Pages are either content pages (article or reference text) or menu pages (a list of links to child pages).
> - To get a menu page, truncate any URL to a parent path and append `.md` (e.g. `https://dev.wix.com/docs/sdk.md`, `https://dev.wix.com/docs/sdk/core-modules.md`).
> - If a reference page seems to be missing its schema (parameters, return types, or type definitions), append `?schema=true` to its `.md` URL (e.g. `https://dev.wix.com/docs/contexts/contexts/stores/category-info/use-category-info-context.md?schema=true`).
> - Top-level index of all portals: https://dev.wix.com/docs/llms.txt
> - Full concatenated docs: https://dev.wix.com/docs/llms-full.txt

## Resource: Constructing a Rule

## Article: Constructing a Rule

## Article Link: https://dev.wix.com/docs/api-reference/business-solutions/restaurants/online-orders/service-fees/rules/constructing-a-rule.md

## Article Content:

# Constructing a Rule

A rule has two main parts: conditions and a fee. When [Calculate Service Fees](https://dev.wix.com/docs/rest/business-solutions/restaurants/service-fees/rules/calculate-service-fees.md) is called, it assesses each rule in relation to the specified order. When a rule is assessed, if the conditions are met, the fee is included in the API's response.

## Conditions

Conditions can be either a single condition or a condition tree.

A single condition evaluates a specific field in the order. For example, it could check if the value of the field is greater than a certain number.

A condition tree contains two conditions and an operator. The conditions can each be either a single condition or a condition tree. There are two operator values:
- `"AND"`: Both conditions must be met for the condition tree to be considered met.
- `"OR"`: At least one of the conditions must be met for the condition tree to be considered met.

### Condition tree example
#### Conditions
For the service fee to be applied, we would need to satisfy these conditions:
* The price subtotal is greater than `50` </br>
    AND
* Either:
    - Delivery type is `"DELIVERY"` </br>
        OR
    - Order is made in the mobile app

#### Example: Conditions are met
We have the following values:
- Subtotal is `70`
- Delivery type is `"DELIVERY"`
- Order is `"WEBSITE"`

In this case, the conditions are met, because the subtotal is greater than `50` and the delivery type is `"DELIVERY"`. It doesn't matter that the platform isn't `"MOBILE_APP"` because we only need that OR delivery type to be `"DELIVERY"`.

#### Example: Conditions are not met
We have the following values:
- Subtotal is `30`
- Delivery type is `"DELIVERY"`
- Order is `"MOBILE_APP"`

In this case, the conditions are not met, because even though the delivery type is `"DELIVERY"` and the platform is `"MOBILE_APP"`, the subtotal is not greater than `50`. 

## Fee

A fee is either a fixed amount or a percentage of the order's subtotal. It can also include tax.

If the conditions are met, the fee is calculated and applied when Calculate Service Fees is called.