Share menus in different stores
This topic demonstrates the implementations of the syncStore API for reusing menus in different stores.
Overview
In a D-store, the same menus can be reused by different stores. Reusing a menu means sharing all the menu information, including the categories, items, modifier groups, and add-on items.
Note: Menu IDs are unique in a D-store.
Use cases
Reuse an existing menu
To add an existing menu to a store, pass only the menu ID of the menu, which is specified in the menuId parameter.
See the following example:
{
"requestId": "20221122211221",
"appId": "210201011541660",
"store": {
"storeId": "20221017storeid01",
"menus": [
{
"menuId": "menu_id_01"
}
]
}
}
Reuse and change an existing menu
Reuse an existing menu from other stores and make changes to the menu with one API call:
- To add an existing menu to a store, pass only the menu ID.
- To make changes to the menu, pass the new information for the menu.
Note: For items in the reused menu, if any changes are made to one of the items (such as changing item status or price), the changes will take effect everywhere with the same item ID in a D-store.
See the following example:
- To reuse an existing menu in the store (
20221017storeid01
), pass the menu ID (menu_id_01
). - To change the name of the menu, specify the name.value object with a new value (
Lunch
).
{
"requestId": "20221122211221",
"appId": "210201011541660",
"store": {
"storeId": "20221017storeid01",
"menus": [
{
"menuId": "menu_id_01",
"name": {
"value": {
"en-US": "Lunch"
}
}
}
]
}
}
Hide a reused menu
To hide a menu from a store, pass the menu ID and specify the menus.status parameter as INVALID
.
For a menu shared by multiple stores, if the menu is hidden from one store, it still exists in other stores and is visible to users. The menu is completely invisible to users only when it is hidden from all stores that share the menu.
For example, the menu (menu_id_01
) is hidden from the store (20221017storeid01
):
{
"requestId": "20221122211221",
"appId": "210201011541660",
"store": {
"storeId": "20221017storeid01",
"menus": [
{
"menuId": "menu_id_01",
"status": "INVALID"
}
]
}
}
Hide a menu and reuse another menu
Hide a menu and reuse another existing menu of the same menu type with one API call:
- To hide a menu from a store, pass the menu ID and specify the menus.status parameter as
INVALID
. - To add another existing menu of the same menu type, pass only the menu ID.
See the following example:
- The menu (
menu_id_02
) is hidden from the store (20221017storeid01
), assuming the menu type isDINEIN
. - The menu (
menu_id_01
) is added and visible to users, assuming the menu type is alsoDINEIN
.
{
"requestId": "20221122211221",
"appId": "210201011541660",
"store": {
"storeId": "20221017storeid01",
"menus": [
{
"menuId": "menu_id_01"
},
{
"menuId": "menu_id_02",
"status": "INVALID"
}
]
}
}