> 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: Restaurants Menus and Ordering

## Article: Restaurants Menus and Ordering

## Article Link: https://dev.wix.com/docs/api-reference/business-solutions/restaurants/skills/restaurants-menus-and-ordering.md

## Article Content:

# RECIPE: Read the Menu and Order Food

## When to use this recipe

- "What's for breakfast and what does it cost?" / "Do you have anything with cardamom?" / "Something vegetarian under 60"
- "Can I order online? Pickup or delivery? Fees?" / "My order is 40, can I get it delivered?"
- "Add 2 flat whites and a shakshuka for pickup" / "Add a cookie, show my order and the total"
- "Check out my café order"

Table reservations and experiences are a different app — see `Table-Reservations.skill.md`.

## Inputs you need before STEP 4

| Input | How to get it |
|---|---|
| Visitor token | STEP 1 |
| Menu `id`, its ordered `sectionIds`; section `id`s with ordered `itemIds`; item `id`, `name`, `description`, `priceInfo.price` | STEP 2 (three list calls, assembled client-side) |
| `operationId` of the ENABLED ordering operation | STEP 3 |
| Fulfillment methods (name, type, `fee`, `minOrderPrice`) | STEP 3 |
| Cart line `id`s (quantity changes) | STEP 4 response |
| Pickup or delivery, the time, and for delivery the address | the visitor, with the times from STEP 6 |

## Decision tree

- **Menu questions** ("what's for breakfast", "anything with X", "under N shekels") → STEP 1 + STEP 2, answer from the assembled tree; group by section **in `sectionIds` order**.
- **"Can I order online / delivery fees / minimum?"** → STEP 3.
- **"Add X to my order"** → STEP 2 (ids) + STEP 3 (`operationId`) → STEP 4 → STEP 5 (totals).
- **"Can I get it delivered for N?"** → compare N with the DELIVERY method's `minOrderPrice` from STEP 3.
- **"For pickup at 12:30" / "deliver to …"** → STEP 6.
- **"Check out"** → STEP 6 (if not done yet), then STEP 7. The hosted checkout has no pickup/delivery or time picker for restaurant orders: set them on the cart first.

---

## STEP 1: Get a visitor token

`GenerateVisitorToken` once; reuse it. The cart is bound to the token.

---

## STEP 2: Read the menu tree

Three visitor-readable GETs on `https://www.wixapis.com/restaurants/menus/v1/`:

```bash
curl 'https://www.wixapis.com/restaurants/menus/v1/menus?onlyVisible=true'    -H 'Authorization: <VISITOR_TOKEN>'
curl 'https://www.wixapis.com/restaurants/menus/v1/sections?onlyVisible=true' -H 'Authorization: <VISITOR_TOKEN>'
curl 'https://www.wixapis.com/restaurants/menus/v1/items?onlyVisible=true'    -H 'Authorization: <VISITOR_TOKEN>'
```

```jsonc
// menus
{ "menus": [{ "id": "7e7c573d-…", "name": "Studio Café", "visible": true, "sectionIds": ["511f021b-…", "8a63287c-…", …] }] }
// sections
{ "sections": [{ "id": "511f021b-…", "name": "Morning", "description": "Served until noon.", "itemIds": ["…", "…"] }] }
// items
{ "items": [{ "id": "…", "name": "Green Shakshuka", "description": "Eggs poached in spinach…",
              "priceInfo": { "price": "58.00", "formattedPrice": "₪58.00" }, "labels": [], "image": { … } },
            { "id": "…", "name": "Chocolate mousse",                           // sized dish: no priceInfo
              "priceVariants": { "variants": [
                { "variantId": "eb3ee27d-…", "priceInfo": { "price": "4.00", "formattedPrice": "€4.00" } },
                { "variantId": "b61aef56-…", "priceInfo": { "price": "7.00", "formattedPrice": "€7.00" } } ] } }] }
```

**Assemble bottom-up and keep the id order**: `menu.sectionIds → section`, `section.itemIds → item`. The flat `sections`/`items` arrays are in creation order, not display order. Skip ids that don't resolve (deleted). Quote `priceInfo.formattedPrice` (REST includes it). `labels` (vegan, spicy…) are usually empty — infer dietary answers from `description` and say so.

**A dish has `priceInfo` or `priceVariants`, never both.** Sized or multi-option dishes carry their prices in `priceVariants.variants[].priceInfo.formattedPrice`; read both fields and never say "price not listed" for them. To name the options, `GET https://www.wixapis.com/restaurants/item-variants/v1/variants` (visitor-readable) and match `variants[].id` to `variantId` ("Chocolate mousse — Single serve €4.00 · Double serve €7.00"); without that call, quote the range ("€4.00–€7.00").

**Answer with matching dishes only.** When the visitor asks for a category ("desserts", "drinks"), list the dishes in that section and any that clearly belong; leave out borderline matches instead of listing them with a caveat.

---

## STEP 3: Is ordering on, and how is food delivered?

```bash
curl 'https://www.wixapis.com/restaurants-operations/v1/operations' -H 'Authorization: <VISITOR_TOKEN>'
curl 'https://www.wixapis.com/fulfillment-methods/v1/fulfillment-methods' -H 'Authorization: <VISITOR_TOKEN>'
```

```jsonc
{ "operations": [{ "id": "48605ac5-…", "default": true, "onlineOrderingStatus": "ENABLED",   // ← operationId for STEP 4
                   "fulfillmentIds": ["…"], "defaultFulfillmentType": "PICKUP" }] }
{ "fulfillmentMethods": [
  { "id": "…", "name": "Delivery", "type": "DELIVERY", "enabled": true, "fee": "15", "minOrderPrice": "60", "deliveryOptions": { "deliveryTimeInMinutes": 60, "deliveryArea": { … } } },
  { "id": "…", "name": "Pickup",   "type": "PICKUP",   "enabled": true, "minOrderPrice": "0", "pickupOptions": { … } },      // "fee" may be absent → 0
  { "id": "…", "name": "DoorDash Drive", "type": "DELIVERY", "enabled": false }
] }
```

- Ordering is possible when at least one operation has `onlineOrderingStatus: "ENABLED"`. `PAUSED_UNTIL`/`DISABLED` → say ordering is closed.
- Show only `enabled: true` methods. `fee` and `minOrderPrice` are decimal strings in the site currency; a missing `fee` means 0.
- "Order of ₪40 delivered?" → `40 < minOrderPrice(60)` → no; offer pickup (no minimum) or suggest adding items.

---

## STEP 4: Add dishes to the cart

`POST https://www.wixapis.com/ecom/v2/carts/current/add-line-items` with the **Restaurants Orders app id** and `operationId`, `menuId` and `menuSectionId` in `options`. Send the section as `menuSectionId`: the checkout validates the dish against that key, and a cart whose lines carry only `sectionId` is refused at checkout with "<dish> is no longer available". `sectionId` may ride along.

```bash
curl -X POST 'https://www.wixapis.com/ecom/v2/carts/current/add-line-items' \
-H 'Authorization: <VISITOR_TOKEN>' -H 'Content-Type: application/json' \
-d '{ "catalogItems": [
  { "quantity": 2, "catalogReference": { "catalogItemId": "<ITEM_ID>", "appId": "9a5d83fd-8570-482e-81ab-cfa88942ee60",
      "options": { "operationId": "<OPERATION_ID>", "menuId": "<MENU_ID>", "menuSectionId": "<SECTION_ID>", "sectionId": "<SECTION_ID>" } } },
  { "quantity": 1, "catalogReference": { "catalogItemId": "<ITEM_ID_2>", "appId": "9a5d83fd-8570-482e-81ab-cfa88942ee60",
      "options": { "operationId": "<OPERATION_ID>", "menuId": "<MENU_ID>", "menuSectionId": "<SECTION_ID_2>", "sectionId": "<SECTION_ID_2>" } } }
] }'
```

→ `cart.id` and `cart.lineItems[]` with `id`, `name.original` ("Flat White"), `quantityInfo.confirmedQuantity`, `pricing.totalPrice`. Use the **section the dish is shown under** (from STEP 2), not any section that happens to contain it. Shop products can share the same cart (different `appId`).

---

## STEP 5: Totals and changes

```bash
curl -X POST 'https://www.wixapis.com/ecom/v2/carts/current/estimate' -H 'Authorization: <VISITOR_TOKEN>' -H 'Content-Type: application/json' -d '{}'
```
→ `summary.priceSummary.subtotal` / `total` (`amount` in the cart currency). Change a quantity with `POST /ecom/v2/carts/current/update-line-items` `{ "lineItems": [{ "lineItemId": "<LINE_ID>", "quantity": { "newQuantity": 3 } }] }`; remove with `POST /ecom/v2/carts/current/remove-line-items` `{ "lineItemIds": ["<LINE_ID>"] }`.

---

## STEP 6: Pickup or delivery, and when

The order's fulfillment is the cart's delivery method, with a code: `PICKUP|ASAP`, `DELIVERY|ASAP`, or `<TYPE>|<startEpochMs>|<endEpochMs>` for a scheduled time. Without one, the hosted checkout shows "There was an issue updating your fulfillment details…" and can't be completed.

**Times.** ASAP per type, and the scheduled slots of a day (`date` is the restaurant's calendar day). For delivery, add the customer's address as `deliveryAddress.addressLine`, `.city`, `.postalCode`, `.country`, `.subdivision`: the delivery slots are then only those of methods that deliver there (none when no method does).

```bash
curl 'https://www.wixapis.com/restaurants-operations/v1/operations/<OPERATION_ID>/first-available-time-slot-per-fulfillment-type' -H 'Authorization: <VISITOR_TOKEN>'
curl 'https://www.wixapis.com/restaurants-operations/v1/operations/<OPERATION_ID>/available-time-slots-per-date?date.day=23&date.month=10&date.year=2026' -H 'Authorization: <VISITOR_TOKEN>'
```

```jsonc
{ "timeslotsPerFulfillmentType": [
  { "fulfilmentType": "PICKUP",
    "timeSlot": { "startTime": "<ISO_TIME>", "endTime": "<ISO_TIME>", "orderSchedulingType": "PREORDER" } }, … ] }
```

Both calls return only slots that can be ordered (the type field is spelled `fulfilmentType`). A slot's code is `<TYPE>|<startTime ms>|<endTime ms>`, built from the slot the visitor picked; an `orderSchedulingType: "ASAP"` entry is `<TYPE>|ASAP`. A slot that has passed is no longer accepted.

**Address.** The cart needs an address before any delivery method is accepted, pickup included (428 `DELIVERY_METHOD_MISSING_ADDRESS`). For pickup, the restaurant's country is enough — take it from the pickup method's `pickupOptions.address` (STEP 3). For delivery, the visitor's street, city and postal code, with the street in `addressLine` (`addressLine1` is dropped) and `subdivision` as `"US-CA"` where the country has them:

```bash
curl -X PATCH 'https://www.wixapis.com/ecom/v2/carts/current' -H 'Authorization: <VISITOR_TOKEN>' -H 'Content-Type: application/json' \
-d '{ "cart": { "deliveryInfo": { "address": { "addressLine": "500 Terry Francine Street", "city": "San Francisco", "postalCode": "94158", "country": "US", "subdivision": "US-CA" } } } }'
```

**Set it:**

```bash
curl -X POST 'https://www.wixapis.com/ecom/v2/carts/current/set-delivery-method' -H 'Authorization: <VISITOR_TOKEN>' -H 'Content-Type: application/json' \
-d '{ "deliveryMethod": { "code": "PICKUP|ASAP" } }'
```

→ `cart.deliveryInfo.method.code` is the code. A 400 `DELIVERY_METHOD_NOT_FOUND` on a delivery code means the address is outside every delivery area: tell the visitor and offer pickup; nothing was set.

---

## STEP 7: Checkout

The cart's `id` is the checkout id. Create a redirect session and give the visitor `redirectSession.fullUrl`:

```bash
curl -X POST 'https://www.wixapis.com/headless/v1/redirect-session' -H 'Authorization: <VISITOR_TOKEN>' -H 'Content-Type: application/json' \
-d '{ "ecomCheckout": { "checkoutId": "<CART_ID>" }, "callbacks": { "postFlowUrl": "<SITE_URL>/" } }'
```

The hosted checkout shows the chosen pickup or delivery and collects contact details and payment. The `checkoutUrl` from `GET /ecom/v1/checkouts/{id}/checkout-url` is a `/checkout?checkoutId=` page that headless sites don't have — don't send visitors there.

Completing a **paid** order needs a payment provider on the site; on a site without one, the checkout shows "We can't accept online payments" — say payment isn't available online yet.

---

## Common errors and how to avoid them

### 1. Cart rejects the dish / item never resolves

`options` is missing `operationId`, `menuId` or `menuSectionId`, or you used the **Stores** app id. Restaurants dishes use `9a5d83fd-8570-482e-81ab-cfa88942ee60`. There is no `variantId` here.

### 2. Sections or dishes in the wrong order

You rendered the flat list arrays. Order comes from `menu.sectionIds` and `section.itemIds`.

### 3. "Add to cart" docs search returns *Create Order* / *Create Item*

Those are management endpoints. The visitor path is always the eCommerce **current cart** with the ids above.

### 4. Checkout says "There was an issue updating your fulfillment details"

No delivery method code on the cart (STEP 6 skipped), or a delivery code without the street, city and country on the cart. A dish then reported "no longer available" is a line sent without `menuSectionId`.

### 5. `fee` is `undefined` on Pickup

Treat a missing fee as 0; only DELIVERY carries a fee and a minimum.

### 6. Answering dietary questions with certainty

Items have no dietary labels on most sites; say "based on the description" when inferring vegetarian/vegan.

### 7. `ExecuteWixAPI` masks failures as "Visitor token rejected (HTTP 403)"

Re-run the single failing call through `CallWixSiteAPI` to see the real 4xx body before reacting; never mint a new token mid-cart.

---

## Constants

| Constant | Value |
|---|---|
| Restaurants Orders (New) app id (cart `catalogReference.appId` for dishes) | `9a5d83fd-8570-482e-81ab-cfa88942ee60` |
| Restaurants Menus app id | `b278a256-2757-4f19-9313-c05c783bec92` |
| Menus base URL | `https://www.wixapis.com/restaurants/menus/v1/` (`menus`, `sections`, `items`) |

---

## References

- [List Menus](https://dev.wix.com/docs/api-reference/business-solutions/restaurants/menus/menus/list-menus.md) · [List Sections](https://dev.wix.com/docs/api-reference/business-solutions/restaurants/menus/sections/list-sections.md) · [List Items](https://dev.wix.com/docs/api-reference/business-solutions/restaurants/menus/items/items/list-items.md) · [List Variants](https://dev.wix.com/docs/api-reference/business-solutions/restaurants/menus/items/item-variants/list-variants.md)
- [List Operations](https://dev.wix.com/docs/api-reference/business-solutions/restaurants/online-ordering/operations/list-operations.md)
- [List Fulfillment Methods](https://dev.wix.com/docs/api-reference/business-solutions/restaurants/online-ordering/fulfillment-methods/list-fulfillment-methods.md)
- [Calculate First Available Time Slot Per Fulfillment Type](https://dev.wix.com/docs/api-reference/business-solutions/restaurants/online-orders/operations/calculate-first-available-time-slot-per-fulfillment-type.md) · [Calculate Available Time Slots For Date](https://dev.wix.com/docs/api-reference/business-solutions/restaurants/online-orders/operations/calculate-available-time-slots-for-date.md)
- [Add Line Items To Current Cart](https://dev.wix.com/docs/api-reference/business-solutions/e-commerce/purchase-flow/cart-v2/add-line-items-to-current-cart.md) · [Update Current Cart](https://dev.wix.com/docs/api-reference/business-solutions/e-commerce/purchase-flow/cart-v2/update-current-cart.md) · [Set Delivery Method For Current Cart](https://dev.wix.com/docs/api-reference/business-solutions/e-commerce/purchase-flow/cart-v2/set-delivery-method-for-current-cart.md)
- [Create Redirect Session](https://dev.wix.com/docs/api-reference/business-management/headless/redirects/create-redirect-session.md)