This guide will be removed on April 29, 2022. Please use our new, easier-to-use Toast technical documentation site. All updated content is on the new site.

Finding the default modifiers for a menu item

When you create an order using the orders API, you must include all of the default modifiers for each menu item selection. If you omit a default modifier, the orders API will not apply it to the menu item. You can find the default modifiers for a menu item in the menu data export file for your restaurant. For general information about the menu data export file, see Getting menu information from the menu data export (deprecated).

The menu data export file contains a JSON representation of the menus configured for your restaurant. The nested hierarchical structure of the JSON matches the structure of your menus. For example, a menu JSON object contains menu group objects, which contain menu item objects. The optionGroups value for a menu item includes MenuOptionGroup objects for the types of modifier that you can apply to the item. The MenuItem objects in the items value of the MenuOptionGroup object are the modifier menu items that you can apply. For example, a salad menu item might have a toppings menu option group that contains menu items such as tomatoes or onions that you can apply as modifiers. The MenuItem objects in a MenuOptionGroup include an isDefault value to indicate whether or not the modifier item is a default modifier for the menu item.

The following example shows a menu, menu group, menu item, and modifier menu items in the JSON menu data export file.

Menu hierarchy in the menu data export file

{
  "entityType": "Menu",
  "name": "Dinner",
  "guid": "7d9e0d3d-b844-4133-943a-4b8d0c160786",
  "groups": [
    {
      "entityType": "MenuGroup",
      "name": "Salads",
      "guid": "bd56a9b4-89c4-4105-bd8e-cdd5d95a1e3c",
      "items": [
        {
          "entityType": "MenuItem",
          "name": "Garden Salad",
          "guid": "ca6c1271-6efb-470e-aa95-da4380d6bf62",1

          [contents omitted]

          "optionGroups": [2
            {
              "entityType": "MenuOptionGroup",
              "name": "Toppings",
              "guid": "be8ff99e-8cfe-4641-88ef-6f4f32d00535",3

              [contents omitted]

              "items": [
                {
                  "entityType": "MenuItem",
                  "name": "Banana peppers",
                  "guid": "3ad58e65-6daf-4c51-90ef-1af45bc33ac3",

                  [contents omitted]

                  "isDefault": false,4
                },
                {
                  "entityType": "MenuItem",
                  "name": "Tomatoes",
                  "guid": "c95060c2-5aa6-44b2-a9d2-b2c1f01468ac",

                  [contents omitted]

                  "isDefault": true,5
                },
          
    [contents omitted]
               

1

The GUID of a menu item.

2

The optionGroups value contains information about the groups of items that you can apply as modifiers.

3

The GUID of one group of modifier menu items.

4

This item is not a default modifier for the menu item.

5

This item is a default modifier for the menu item.


The following example shell script uses a jq command to select the default modifiers for a menu item from the menu data export file for a restaurant. For more information about the jq utility, see the jq web site.

Using the jq utility to find the default modifiers for a menu item

#!/bin/bash

MENU_EXPORT_FILE="MenuExport_5c2dad3f-1b13-5be3-bc52-d132244153c5.json"1

MENU_GUID="315267d2-80fd-4aef-95aa-62adf41bdb7a"2
MENU_GROUP_GUID="974c43f7-a357-4bef-92aa-00a1238e22e1"3
MENU_ITEM_GUID="dc426c22-e132-4adf-4adf-d82b1fe512b3"4

jq --arg MENU_GUID ${MENU_GUID} \5
--arg MENU_GROUP_GUID ${MENU_GROUP_GUID} \
--arg MENU_ITEM_GUID ${MENU_ITEM_GUID} \
'.[] | select(.guid==$MENU_GUID) | .groups[] | select(.guid==$MENU_GROUP_GUID)
| .items[] | select(.guid==$MENU_ITEM_GUID) | .optionGroups[].items[] 
| select(.isDefault==true)' \6
${MENU_EXPORT_FILE}

1

The menu data export file contains a JSON representation of the menus configured for your restaurant. For general information about the menu data export file, see Getting menu information from the menu data export (deprecated).

2

To find the default modifiers for a menu item, you locate the item in the menu and menu group that contain that contain it. This variable stores the GUID of the menu that contains the item.

3

This variable stores the GUID of the menu group that contains the item.

4

This variable stores the GUID of the menu item that this example script finds the default modifiers for.

5

This jq command filters the JSON contents of the menu data export file. For more information about the jq utility command syntax, see the jq web site.

6

These jq command filters select one menu item from its menu and menu group. It then selects each menu item in the optionGroup array for that menu item if the isDefault value for the optionGroup is true.


The following example shows menu items that are the default modifiers for a menu item. These menu item objects were filtered from the menu data export file for a restaurant using the jq command shown in Using the jq utility to find the default modifiers for a menu item.

Default modifiers for a menu item

{
  "entityType": "MenuItem",
  "name": "Cucumber",
  "guid": "e47b25f2-2c13-4428-b344-34b3214515d1",
  "description": "",
  "sku": null,
  "plu": null,
  "maxSelections": null,
  "price": 0,
  "isDefault": true,
  "optionGroups": [],
  "idString": null
}
{
  "entityType": "MenuItem",
  "name": "Green Peppers",
  "guid": "f9ec9a05-5c60-42dc-ad17-db0fb6be93c7",
  "description": "",
  "sku": null,
  "plu": null,
  "maxSelections": null,
  "price": 0,
  "isDefault": true,
  "optionGroups": [],
  "idString": null
}
{
  "entityType": "MenuItem",
  "name": "Onions",
  "guid": "ececb63f-0491-4955-9331-4ad2cd685e60",
  "description": "",
  "sku": null,
  "plu": null,
  "maxSelections": null,
  "price": 0,
  "isDefault": true,
  "optionGroups": [],
  "idString": null
}
{
  "entityType": "MenuItem",
  "name": "Tomato",
  "guid": "cb5dc6ee-2c25-4fcc-aff8-8452c9bf19e1",
  "description": "",
  "sku": null,
  "plu": null,
  "maxSelections": null,
  "price": 0,
  "isDefault": true,
  "optionGroups": [],
  "idString": null
}
{
  "entityType": "MenuItem",
  "name": "Garlic Croutons",
  "guid": "17831034-c2bc-4cca-b845-c52f441955be",
  "description": "",
  "sku": null,
  "plu": null,
  "maxSelections": null,
  "price": 0,
  "isDefault": true,
  "optionGroups": [],
  "idString": null
}