> 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: Rules

# Type: Rule Object

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

## Description: A rule defines the fee that is applied when specific conditions (also defined by the rule) are met. You can use a rule to apply a service fee to a restaurant order.

## Schema:

```json
 Type: Rule Object | type: Rule
 Description: A rule defines the fee that is applied when specific conditions (also defined by the rule) are met. You can use a rule to apply a service fee to a restaurant order.
       - name: id  | type: string | description: Rule ID.
           - name: value  | type: string | description: 
       - name: locationId  | type: string | description: Business location ID ([SDK](https://dev.wix.com/docs/sdk/backend-modules/restaurants/wix-restaurants-new/about-business-locations.md) | [REST](https://dev.wix.com/docs/rest/business-solutions/restaurants/wix-restaurants-new/about-business-locations.md)) of the rule.
       - name: name  | type: string | description: Rule name.
       - name: createdDate  | type: string | description: Date and time the rule was created.
           - name: seconds  | type: string | description: 
           - name: nanos  | type: number | description: 
       - name: updatedDate  | type: string | description: Date and time the rule was updated.
       - name: taxRate  | type: string | description: Percentage value to apply as a custom tax rate. For example, `5` represents a 5% fee applied to the order's total. <br /> Min: '0'. <br /> Max: `100`.
       - name: conditionsType  | type: string | description: Specifies the type of condition.
           enum: NO_CONDITIONS, CONDITION, CONDITION_TREE
       - name: conditionType  | type: string | description: Specifies the type of condition.
           enum: UNDEFINED_CONDITION_TYPE, CONDITION, CONDITION_TREE
       - name: enabled  | type: boolean | description: Whether the rule is enabled. If `true`, the rule is evaluated when service fees are calculated. If `false`, the rule will not be evaluated when service fees are calculated.
           - name: value  | type: boolean | description: 
       - name: revision  | type: string | description: Revision number. Increments by 1 each time the rule is updated. To prevent conflicting changes, the existing `revision` must be used when updating a rule.
           - name: value  | type: number | description: 
       - name: label  | type: string | description: DEPRECATED. Defines the app that the rule is connected to.
       - name: appId  | type: string | description: Defines the app that the rule is connected to.
       - name: roundingStrategy  | type: string | description: Rounding strategy to apply to fee and tax calculation.
           enum: HALF_UP, HALF_EVEN
       - name: extendedFields  | type: ExtendedFields | description: Data Extensions
           - name: namespaces  | type: object | description: Extended field data. Each key corresponds to the namespace of the app that created the extended fields. The value of each key is structured according to the schema defined when the extended fields were configured.  You can only access fields for which you have the appropriate permissions.  Learn more about [extended fields](https://dev.wix.com/docs/rest/articles/getting-started/extended-fields.md).
       - name: tags  | type: Tags | description: Tags ([SDK](https://dev.wix.com/docs/sdk/backend-modules/tags/tags/introduction.md) | [REST](https://dev.wix.com/docs/rest/business-management/tags/introduction.md)) used to classify and sort different types of rules.
           - name: privateTags  | type: TagList | description: Tags that require an additional permission in order to access them, normally not given to site members or visitors.
               - name: tagIds  | type: Array<string> | description: List of tag IDs
           - name: tags  | type: TagList | description: Tags that are exposed to anyone who has access to the labeled entity itself, including site members and visitors.
       - ONE-OF:
           - name: amount  | type: Money | description: Fixed fee. Must hold a positive value.
               - name: value  | type: string | description: Monetary amount. Decimal string with a period as a decimal separator (e.g., 3.99). Optionally, a single (-), to indicate that the amount is negative.
               - name: currency  | type: string | description: Currency code. Must be valid ISO 4217 currency code (e.g., USD).
               - name: formattedValue  | type: string | description: Monetary amount. Decimal string in local format (e.g., 1 000,30). Optionally, a single (-), to indicate that the amount is negative.
           - name: percentage  | type: string | description: Percentage fee. For example, `5` represents a 5% fee applied to the order's total.
       - ONE-OF:
           - name: fixedFee  | type: Money | description: Fixed fee. Must hold a positive value.
               - name: value  | type: string | description: Monetary amount. Decimal string with a period as a decimal separator (e.g., 3.99). Optionally, a single (-), to indicate that the amount is negative.
               - name: currency  | type: string | description: Currency code. Must be valid ISO 4217 currency code (e.g., USD).
               - name: formattedValue  | type: string | description: Monetary amount. Decimal string in local format (e.g., 1 000,30). Optionally, a single (-), to indicate that the amount is negative.
           - name: percentageFee  | type: string | description: Percentage fee. For example, `5` represents a 5% fee applied to the order's total.
       - ONE-OF:
           - name: condition  | type: Condition | description: Single condition that must be met for the rule to be applied to an order.
               - name: path  | type: string | description: Path of the field in the order entity that this condition will evaluate. For example, `priceSummary.subtotal`.
               - name: orderFieldPath  | type: string | description: Path of the field in the order entity that this condition will evaluate. For example, `priceSummary.subtotal`.
               - name: expectedType  | type: ExpectedType | description: Type of the field specified in `orderFieldPath`. For example, the type of `priceSummary.subtotal` is `"NUMBER"`).
                   - name: value  | type: string | description: Type of the field specified in `orderFieldPath`.
               - name: expectedFieldType  | type: string | description: Type of the field specified in `orderFieldPath`. For example, the type of `priceSummary.subtotal` is `"NUMBER"`).
                   enum: UNKNOWN_EXPECTED_FIELD_TYPE, NUMBER, STRING
               - ONE-OF:
                   - name: number  | type: Number | description: Contains a numeric value and an operation.  Required if `expectedFieldType` is `NUMBER`.
                       - name: value  | type: number | description: Numeric value to compare with the value of the specified field.
                       - name: operation  | type: string | description: Operation to use.
                   - name: list  | type: List | description: Contains an array of strings to compare with the value of the specified field. If the value of the field matches a string in the array, the condition is considered met.  Required if `expectedFieldType` is `LIST`.
                       - name: values  | type: Array<string> | description: Array of string values to compare with the value of the field. If the value of the fields matches a string in the array, the condition is considered met.
           - name: conditionTree  | type: ConditionTree | description: Binary tree of conditions. Use the operator to indicate whether only one or both conditions must be met in order for a service fee rule to be applied to an order.
               - name: operator  | type: string | description: Specifies the logical operator to use when combining the evaluation of the left and right conditions.
                   enum: AND, OR
               - ONE-OF:
                   - name: leftCondition  | type: Condition | description: Single condition that must be met for the rule to be applied to an order.
                   - name: leftConditionsTree  | type: ConditionTree | description: Binary tree of conditions. Use the operator to indicate whether only one or both conditions must be met in order for a service fee rule to be applied to an order.
               - ONE-OF:
                   - name: rightCondition  | type: Condition | description: Single condition that must be met for the rule to be applied to an order.
                   - name: rightConditionsTree  | type: ConditionTree | description: Binary tree of conditions. Use the operator to indicate whether only one or both conditions must be met in order for a service fee rule to be applied to an order.
       - ONE-OF:
           - name: conditionOptions  | type: Condition | description: Single condition that must be met for the rule to be applied to an order.
           - name: conditionTreeOptions  | type: ConditionTree | description: Binary tree of conditions. Use the operator to indicate whether only one or both conditions must be met in order for a service fee rule to be applied to an order.
       - ONE-OF:
           - name: customTaxRate  | type: string | description: Percentage value to apply as a custom tax rate. Range: [0-100].
           - name: taxGroupId  | type: string | description: Tax group ID. Internal only.

```