Add menus, categories, or items

This topic demonstrates the implementations of the syncStore API for adding more menus, categories, or items.

Overview

The syncStore API enables you to add menus, categories, or items to an existing store that has been synchronized via the syncStore API. For the use case to synchronize store information, see Synchronize a store.

Use cases

Add a menu

To add a menu to an existing store, pass the storeId parameter and make sure the store information has been synchronized via the syncStore API.

Things to know:

  • menus.type is unique under the same store, that is, a store can only hold one menu for each type (pickup, dine-in, and delivery), including the hidden menus (specified in the menus.status parameter).

Note: To make a menu invisible to users, see Hide a menu.

  • To make a menu valid for users, specify the corresponding business rules based on the menu type (that is, the store.bizRules parameter). Make sure the value of store.bizRules.scene is unique.

The following example demonstrates adding a dine-in menu to the store (20221017storeid01). Make sure the dine-in-related rules are already specified in the store.bizRules parameter.

copy
{
    "requestId": "2212234****",
    "appId": "21020101154****",
    "store": {
        "storeId": "20221017storeid01",
        "menus": [
            {
                "menuId": "menu_id_02",
                "name": {
                    "value": {
                        "en-US": "Lunch"
                    }
                },
                "status": "VALID",
                "type": "DINEIN",
                "minPrepareMinutes": 15
            }
        ]
    }
}

Add a category

To add a category to an existing menu, pass the storeId and menuId parameters. Make sure the store and menu information has been synchronized via the syncStore API.

The following example demonstrates adding a category to the menu (menu_id_02) in the store (20221017storeid01):

copy
{
    "requestId": "2211111111****",
    "appId": "21020101154***",
    "store": {
        "storeId": "20221017storeid01",
        "menus": [
            {
                "menuId": "menu_id_02",
                "categories": [
                    {
                        "categoryId": "DINE_IN_category_01",
                        "name": {
                            "value": {
                                "en-US": "Limited Time Offer"
                            }
                        },
                        "iconUrl": "https://www.example.com/images/antfincdn/cdZOWIR73/0011icon.jpg",
                        "status": "ACTIVE",
                        "extendInfo": {
                            "subtitle": {
                                "value": {
                                    "en-US": "Main Course"
                                }
                            }
                        }
                    }
                ]
            }
        ]
    }
}

Add an item

You can add single items to an existing category with or without modifier groups. You can also add add-on items directly.

Add a single item

To add a single item, pass the storeId, menuId, and categoryId parameters. Make sure the store, menu, and category information have been synchronized via the syncStore API.

There are two scenarios you can expect:

Without modifier groups

The following example demonstrates adding a single item without modifier groups (storeId: 20221017storeid01, menuId: menu_id_02, and categoryId: DINE_IN_category_01):

copy
{
    "requestId": "2211234****",
    "appId": "2102010115****",
    "store": {
        "storeId": "20221017storeid01",
        "menus": [
            {
                "menuId": "menu_id_02",
                "categories": [
                    {
                        "categoryId": "DINE_IN_category_01",
                        "items": [
                            {
                                "itemId": "item_01",
                                "name": {
                                    "value": {
                                        "en-US": "Nachos Deluxe Double Beef"
                                    }
                                },
                                "status": "AVAILABLE",
                                "saleType": "SINGLE",
                                "originAmount": {
                                    "currency": "SGD",
                                    "value": "4000"
                                },
                                "saleAmount": {
                                    "currency": "SGD",
                                    "value": "2000"
                                },
                                "quantityRule": {
                                    "min": 0,
                                    "max": 99
                                },
                                "skuPropertyGroups": [
                                    {
                                        "name": {
                                            "value": {
                                                "en-US": "size"
                                            }
                                        },
                                        "skuGroupId": "27731",
                                        "properties": [
                                            {
                                                "name": {
                                                    "value": {
                                                        "en-US": "Small"
                                                    }
                                                },
                                                "propertyId": "Small"
                                            },
                                            {
                                                "name": {
                                                    "value": {
                                                        "en-US": "Large"
                                                    }
                                                },
                                                "propertyId": "Large"
                                            }
                                        ]
                                    },
                                    {
                                        "skuGroupId": "27733",
                                        "name": {
                                            "value": {
                                                "en-US": "Level of Spiciness"
                                            }
                                        },
                                        "properties": [
                                            {
                                                "name": {
                                                    "value": {
                                                        "en-US": "No Chili"
                                                    }
                                                },
                                                "propertyId": "No Chili"
                                            },
                                            {
                                                "name": {
                                                    "value": {
                                                        "en-US": "less Chili"
                                                    }
                                                },
                                                "propertyId": "Less Chili"
                                            },
                                            {
                                                "name": {
                                                    "value": {
                                                        "en-US": "Normal Chili"
                                                    }
                                                },
                                                "propertyId": "Normal Spicy"
                                            }
                                        ]
                                    }
                                ],
                                "skus": [
                                    {
                                        "skuId": "tsku2121",
                                        "skuPropertyPairs": {
                                            "27731": "Small",
                                            "27733": "Normal Spicy"
                                        },
                                        "originAmount": {
                                            "currency": "SGD",
                                            "value": 100
                                        },
                                        "saleAmount": {
                                            "currency": "SGD",
                                            "value": 90
                                        },
                                        "contents": [
                                            {
                                                "type": "IMAGE",
                                                "scene": "BACKGROUND",
                                                "value": "https://www.example.com/images/uploads/meals/0f62cf2de02248cee773f990ca.JPG"
                                            }
                                        ]
                                    },
                                    {
                                        "skuId": "tsku2122",
                                        "skuPropertyPairs": {
                                            "27731": "Large",
                                            "27733": "Normal Spicy"
                                        },
                                        "originAmount": {
                                            "currency": "SGD",
                                            "value": 100
                                        },
                                        "saleAmount": {
                                            "currency": "SGD",
                                            "value": 80
                                        },
                                        "contents": [
                                            {
                                                "type": "IMAGE",
                                                "scene": "BACKGROUND",
                                                "value": "https://wwww.example.com/images/uploads/meals/2cf2dfssdmgkeqec1c.png"
                                            }
                                        ]
                                    }
                                ],
                                "contents": [
                                    {
                                        "type": "IMAGE",
                                        "scene": "BACKGROUND",
                                        "value": "https://omni.posplus-crm.com/Omni_FnbItem/store01/NSDLX_DBBF_AC.png"
                                    },
                                    {
                                        "type": "TEXT",
                                        "scene": "DESCRIPTION",
                                        "value": "{\"value\":{\"en-US\":\"For those who prefer a cheesy meal, indulge in our Nachos Deluxe Double Beef. Served with two beef patties, American cheese, lettuce and a combination of different sauces such as mayonnaise, ketchup and Nachos Cheese sauce!\"}}"
                                    }
                                ],
                                "extendInfo": {
                                    "subTitle": {
                                        "value": {
                                            "en-US": "delicious chicken"
                                        }
                                    },
                                    "takeAwayFee": {
                                        "currency": "SGD",
                                        "value": 100
                                    },
                                    "serviceSchedules": [
                                        {
                                            "scheduleType": "DAILY",
                                            "schedules": {
                                                "FIXED": [
                                                    {
                                                        "startTime": "00:00+08:00",
                                                        "endTime": "23:59+08:00"
                                                    }
                                                ]
                                            }
                                        }
                                    ]
                                }
                            }
                        ]
                    }
                ]
            }
        ]
    }
}

With modifier groups

The following example demonstrates adding a single item with modifier groups (storeId: 20221017storeid01, menuId: menu_id_02, and categoryId: DINE_IN_category_01):

copy
{
    "requestId": "2211234****",
    "appId": "2102010115****",
    "store": {
        "storeId": "20221017storeid01",
        "menus": [
            {
                "menuId": "menu_id_02",
                "categories": [
                    {
                        "categoryId": "DINE_IN_category_01",
                        "items": [
                            {
                                "itemId": "item_02",
                                "name": {
                                    "value": {
                                        "en-US": "Nachos Deluxe Double Beef"
                                    }
                                },
                                "status": "AVAILABLE",
                                "saleType": "SINGLE",
                                "originAmount": {
                                    "currency": "SGD",
                                    "value": "4000"
                                },
                                "saleAmount": {
                                    "currency": "SGD",
                                    "value": "2000"
                                },
                                "quantityRule": {
                                    "min": 0,
                                    "max": 99
                                },
                                "skuPropertyGroups": [
                                    {
                                        "name": {
                                            "value": {
                                                "en-US": "size"
                                            }
                                        },
                                        "skuGroupId": "27731",
                                        "properties": [
                                            {
                                                "name": {
                                                    "value": {
                                                        "en-US": "Small"
                                                    }
                                                },
                                                "propertyId": "Small"
                                            },
                                            {
                                                "name": {
                                                    "value": {
                                                        "en-US": "Large"
                                                    }
                                                },
                                                "propertyId": "Large"
                                            }
                                        ]
                                    },
                                    {
                                        "skuGroupId": "27733",
                                        "name": {
                                            "value": {
                                                "en-US": "Level of Spiciness"
                                            }
                                        },
                                        "properties": [
                                            {
                                                "name": {
                                                    "value": {
                                                        "en-US": "No Chili"
                                                    }
                                                },
                                                "propertyId": "No Chili"
                                            },
                                            {
                                                "name": {
                                                    "value": {
                                                        "en-US": "less Chili"
                                                    }
                                                },
                                                "propertyId": "Less Chili"
                                            },
                                            {
                                                "name": {
                                                    "value": {
                                                        "en-US": "Normal Chili"
                                                    }
                                                },
                                                "propertyId": "Normal Spicy"
                                            }
                                        ]
                                    }
                                ],
                                "skus": [
                                    {
                                        "skuId": "tsku2121",
                                        "skuPropertyPairs": {
                                            "27731": "Small",
                                            "27733": "Normal Spicy"
                                        },
                                        "originAmount": {
                                            "currency": "SGD",
                                            "value": 100
                                        },
                                        "saleAmount": {
                                            "currency": "SGD",
                                            "value": 90
                                        },
                                        "contents": [
                                            {
                                                "type": "IMAGE",
                                                "scene": "BACKGROUND",
                                                "value": "https://www.example.com/images/uploads/meals/0f62cf2de02248cee773f990ca.JPG"
                                            }
                                        ]
                                    },
                                    {
                                        "skuId": "tsku2122",
                                        "skuPropertyPairs": {
                                            "27731": "Large",
                                            "27733": "Normal Spicy"
                                        },
                                        "originAmount": {
                                            "currency": "SGD",
                                            "value": 100
                                        },
                                        "saleAmount": {
                                            "currency": "SGD",
                                            "value": 80
                                        },
                                        "contents": [
                                            {
                                                "type": "IMAGE",
                                                "scene": "BACKGROUND",
                                                "value": "https://wwww.example.com/images/uploads/meals/2cf2dfssdmgkeqec1c.png"
                                            }
                                        ]
                                    }
                                ],
                                "contents": [
                                    {
                                        "type": "IMAGE",
                                        "scene": "BACKGROUND",
                                        "value": "https://omni.posplus-crm.com/Omni_FnbItem/store01/NSDLX_DBBF_AC.png"
                                    },
                                    {
                                        "type": "TEXT",
                                        "scene": "DESCRIPTION",
                                        "value": "{\"value\":{\"en-US\":\"For those who prefer a cheesy meal, indulge in our Nachos Deluxe Double Beef. Served with two beef patties, American cheese, lettuce and a combination of different sauces such as mayonnaise, ketchup and Nachos Cheese sauce!\"}}"
                                    }
                                ],
                                "extendInfo": {
                                    "subTitle": {
                                        "value": {
                                            "en-US": "delicious chicken"
                                        }
                                    },
                                    "takeAwayFee": {
                                        "currency": "SGD",
                                        "value": 100
                                    },
                                    "serviceSchedules": [
                                        {
                                            "scheduleType": "DAILY",
                                            "schedules": {
                                                "FIXED": [
                                                    {
                                                        "startTime": "00:00+08:00",
                                                        "endTime": "23:59+08:00"
                                                    }
                                                ]
                                            }
                                        }
                                    ]
                                },
                                "modifierGroups": [
                                    {
                                        "groupId": "MODIFIERGROUP01",
                                        "name": {
                                            "value": {
                                                "en-US": "Add-On"
                                            }
                                        },
                                        "quantityRule": {
                                            "min": 0,
                                            "max": 12
                                        },
                                        "childItems": [
                                            {
                                                "itemId": "201002||300009||@CD",
                                                "name": {
                                                    "value": {
                                                        "en-US": "Add Beef Patty"
                                                    }
                                                },
                                                "saleType": "ADDON",
                                                "originAmount": {
                                                    "currency": "SGD",
                                                    "value": 1000
                                                },
                                                "saleAmount": {
                                                    "currency": "SGD",
                                                    "value": 350
                                                }
                                            }
                                        ]
                                    }
                                ]
                            }
                        ]
                    }
                ]
            }
        ]
    }
}

Add an add-on item

To add an add-on item to an existing modifier group, pass the storeId, menuId, categoryId, itemId (for the single item), and groupId (for the modifier group) parameters. Make sure the store, menu, category, item, and modifier group information have been synchronized via the syncStore API.

Things to know:

  • Pass all existing modifier groups (at least the group IDs) for the single item, otherwise, they will be removed from the item.
  • For the target modifier group with an add-on item to add, pass all existing add-on items (at least the item IDs) and the newly specified add-on item.

See the following example:

  • The target modifier group (MODIFIERGROUP01) belongs to the item (item_02) in the category (DINE_IN_category_01) under the menu (menu_id_02) of the store (20221017storeid01). This modifier group contains an add-on item (addonitem01).
  • To specify a new add-on item (addonitem02) in the modifier group, pass the new add-on item information and at least the item ID of the existing add-on item.

copy
{
    "requestId": "2211234****",
    "appId": "2102010115****",
    "store": {
        "storeId": "20221017storeid01",
        "menus": [
            {
                "menuId": "menu_id_02",
                "categories": [
                    {
                        "categoryId": "DINE_IN_category_01",
                        "items": [
                            {
                                "itemId": "item_02",
                                "modifierGroups": [
                                    {
                                        "groupId": "MODIFIERGROUP01",
                                        "childItems": [
                                            {
                                                "itemId": "addonitem01"
                                            },
                                            {
                                                "itemId": "addonitem02",
                                                "name": {
                                                    "value": {
                                                        "en-US": "Add Beef Patty"
                                                    }
                                                },
                                                "saleType": "ADDON",
                                                "originAmount": {
                                                    "currency": "SGD",
                                                    "value": 1000
                                                },
                                                "saleAmount": {
                                                    "currency": "SGD",
                                                    "value": 350
                                                }
                                            }
                                        ]
                                    }
                                ]
                            }
                        ]
                    }
                ]
            }
        ]
    }
}

Add a modifier group

To add a modifier group to an existing single item, pass the storeId, menuId, categoryId, and itemId (for the single item) parameters. Make sure the store, menu, category, and item information have been synchronized via the syncStore API.

Things to know:

  • Pass all existing modifier groups (at least the group IDs) for the single item, otherwise, they will be removed from the item.
  • Pass the newly specified modifier group.

Add an existing modifier group

To reuse an existing modifier group in a single item, pass only the group ID of the modifier group.

See the following example:

  • The single item (item_02) contains a modifier group (MODIFIERGROUP01).
  • To add an existing modifier group to the single item, pass only the group ID (MODIFIERGROUP02).
copy
{
    "requestId": "2211234****",
    "appId": "2102010115****",
    "store": {
        "storeId": "20221017storeid01",
        "menus": [
            {
                "menuId": "menu_id_02",
                "categories": [
                    {
                        "categoryId": "DINE_IN_category_01",
                        "items": [
                            {
                                "itemId": "item_02",
                                "modifierGroups": [
                                    {
                                        "groupId": "MODIFIERGROUP01"
                                    },
                                    {
                                        "groupId": "MODIFIERGROUP02"
                                    }
                                ]
                            }
                        ]
                    }
                ]
            }
        ]
    }
}

Add a new modifier group

To add a new modifier group, pass all the information needed for the modifier group.

See the following example:

  • The single item (item_02) contains a modifier group (MODIFIERGROUP01).
  • To add a new modifier group (MODIFIERGROUP03) to the single item, pass all the modifier group information.

copy
{
    "requestId": "2211234****",
    "appId": "2102010115****",
    "store": {
        "storeId": "20221017storeid01",
        "menus": [
            {
                "menuId": "menu_id_02",
                "categories": [
                    {
                        "categoryId": "DINE_IN_category_01",
                        "items": [
                            {
                                "itemId": "item_02",
                                "modifierGroups": [
                                    {
                                        "groupId": "MODIFIERGROUP01"
                                    },
                                    {
                                        "groupId": "MODIFIERGROUP03",
                                        "name": {
                                            "value": {
                                                "en-US": "Add-On"
                                            }
                                        },
                                        "quantityRule": {
                                            "min": 0,
                                            "max": 12
                                        },
                                        "childItems": [
                                            {
                                                "itemId": "201002||300009||@CD",
                                                "name": {
                                                    "value": {
                                                        "en-US": "Add Beef Patty"
                                                    }
                                                },
                                                "saleType": "ADDON",
                                                "originAmount": {
                                                    "currency": "SGD",
                                                    "value": 1000
                                                },
                                                "saleAmount": {
                                                    "currency": "SGD",
                                                    "value": 350
                                                }
                                            }
                                        ]
                                    }
                                ]
                            }
                        ]
                    }
                ]
            }
        ]
    }
}