Set item or modifier group sequence
This topic demonstrates the implementations of the syncStore API to set the sequence of items (both single items and add-on items) or modifier groups displayed to users.
Overview
To set the sequence of single items, add-on items, or modifier groups, specify the items.sequence, childItems.sequence, or modifierGroups.sequence parameters, respectively.
Things to know:
- The value range of the parameters above is 0-65535. Items or modifier groups are displayed from the smallest value to the largest value. For example, if the value is
0
, the item or modifier group is displayed in the first position. - If this parameter is not passed or passed with no value specified, it is by default set to
65535
. - Items or modifier groups with the same value for the sequence parameters are not sorted.
Use Cases
Set item sequence
You can set the sequence for single items or add-on items that have been synchronized via the syncStore API.
Set single item sequence
To set the sequence for single items, pass the storeId, menuId, categoryId, items.itemId (for the single item), and items.sequence parameters. Make sure the store, menu, category, and single item information have been synchronized via the syncStore API.
There are two scenarios you can expect:
Set sequence for existing single items
You can set the sequence for the existing single items in a category.
As the following example shows, the sequence (from 1 to 4) of the existing single items in the category (category_id_01
) is item_id_01
, item_id_02
, item_id_03
, and item_id_04
.
{
"requestId": "202212071012340000001",
"appId": "210201011541660",
"store": {
"storeId": "20221001storeid04", // (Required) The store where the existing single item belongs
"menus": [
{
"menuId": "menu_id_01", // (Required) The menu where the existing single item belongs
"categories": [
{
"categoryId": "category_id_01", // (Required) The category where the existing single item belongs
"items": [
{
"itemId": "item_id_01", // (Required) The existing single item to set sequence
"sequence":1 // (Optional) Specify this parameter if you want to sort the existing single items.
},
{
"itemId": "item_id_02",
"sequence":2
},
{
"itemId": "item_id_03",
"sequence":3
},
{
"itemId": "item_id_04",
"sequence":4
}
]
}
]
}
]
}
}
Set sequence for reused single items
You can also set a different sequence for existing single items that are reused in a different category.
As the following example shows, for the same single items:
- The sequence (from 1 to 4) of the existing single items in the category (
category_id_01
) isitem_id_01
,item_id_02
,item_id_03
, anditem_id_04
. - The sequence (from 1 to 4) for the reused single items in the category (
category_id_02
) isitem_id_04
,item_id_03
,item_id_02
, anditem_id_01
.
{
"requestId": "202212071012340000001",
"appId": "210201011541660",
"store": {
"storeId": "20221001storeid04", // (Required) The store where the reused single item belongs
"menus": [
{
"menuId": "menu_id_01", // (Required) The menu where the reused single item belongs
"categories": [
{
"categoryId": "category_id_01",
"items": [
{
"itemId": "item_id_01", // The existing single item
"sequence":1 // The sequence of the existing single item
},
{
"itemId": "item_id_02",
"sequence":2
},
{
"itemId": "item_id_03",
"sequence":3
},
{
"itemId": "item_id_04",
"sequence":4
},
]
},
{
"categoryId": "category_id_02", // (Required) The category where the reused single item belongs
"items": [
{
"itemId": "item_id_01", // (Required) The reused single item to set sequence
"sequence":4 // (Optional) Specify this parameter if you want to sort the reused single items.
},
{
"itemId": "item_id_02",
"sequence":3
},
{
"itemId": "item_id_03",
"sequence":2
},
{
"itemId": "item_id_04",
"sequence":1
}
]
}
]
}
]
}
}
Set add-on item sequence
To set the sequence for add-on items, pass the storeId, menuId, categoryId, items.itemId (for the single item), groupId, childItems.itemId (for the add-on item), and childItems.sequence parameters. Make sure the store, menu, category, single item, modifier group, and add-on item information have been synchronized via the syncStore API.
There are two scenarios you can expect:
Set sequence for existing add-on items
You can set the sequence for the existing add-on items in a modifier group.
As the following example shows, the sequence (from 1 to 4) of the existing add-on items in the modifier group (300001_01
) is 300001_01_01
, 300001_01_02
, 300001_01_03
, and 300001_01_04
.
{
"requestId": "202212071012340000002",
"appId": "210201011541660",
"store": {
"storeId": "20221001storeid04", // (Required) The store where the existing add-on item belongs
"menus": [
{
"menuId": "menu_id_01", // (Required) The menu where the existing add-on item belongs
"categories": [
{
"categoryId": "category_id_01", // (Required) The category where the existing add-on item belongs
"items": [
{
"itemId": "300001", // (Required) The single item where the existing add-on item belongs
"modifierGroups": [
{
"groupId": "300001_01", // (Required) The modifier group where the existing add-on item belongs
"childItems": [
{
"itemId": "300001_01_01", // (Required) The existing add-on item to set sequence
"sequence":1 // (Optional) Specify this parameter if you want to sort the existing add-on items.
},
{
"itemId": "300001_01_02",
"sequence":2
},
{
"itemId": "300001_01_03",
"sequence":3
},
{
"itemId": "300001_01_04",
"sequence":4
}
]
}
]
}
]
}
]
}
]
}
}
Set sequence for reused add-on items
You can also set a different sequence for existing add-on items that are reused in a different modifier group.
As the following example shows, for the same add-on items:
- The sequence (from 1 to 4) of the existing add-on items in the modifier group (
300001_01
) is300001_01_01
,300001_01_02
,300001_01_03
, and300001_01_04
. - The sequence (from 1 to 4) of the reused add-on items in the modifier group (
300002_01
) is300001_01_04
,300001_01_03
,300001_01_02
, and300001_01_01
.
{
"requestId": "202212071012340000002",
"appId": "210201011541660",
"store": {
"storeId": "20221001storeid04", // (Required) The store where the reused add-on item belongs
"menus": [
{
"menuId": "menu_id_01", // (Required) The menu where the reused add-on item belongs
"categories": [
{
"categoryId": "category_id_01", // (Required) The category where the reused add-on item belongs
"items": [
{
"itemId": "300001",
"modifierGroups": [
{
"groupId": "300001_01",
"childItems": [
{
"itemId": "300001_01_01", // The existing add-on item
"sequence":1 // The sequence of the existing add-on item
},
{
"itemId": "300001_01_02",
"sequence":2
},
{
"itemId": "300001_01_03",
"sequence":3
},
{
"itemId": "300001_01_04",
"sequence":4
}
]
}
]
},
{
"itemId": "300002", // (Required) The single item where the reused add-on item belongs
"modifierGroups": [
{
"groupId": "300002_01", // (Required) The modifier group where the reused add-on item belongs
"childItems": [
{
"itemId": "300001_01_01", // (Required) The reused add-on item to set sequence
"sequence":4 // (Optional) Specify this parameter if you want to sort the reused add-on item.
},
{
"itemId": "300001_01_02",
"sequence":3
},
{
"itemId": "300001_01_03",
"sequence":2
},
{
"itemId": "300001_01_04",
"sequence":1
}
]
}
]
}
]
}
]
}
]
}
}
Set modifier group sequence
To set the sequence for add-on items, pass the storeId, menuId, categoryId, items.itemId (for the single item), groupId, and modifierGroups.sequence parameters. Make sure the store, menu, category, single item, and modifier group information have been synchronized via the syncStore API.
There are two scenarios you can expect:
Set sequence for existing modifier groups
You can set the sequence for the existing modifier groups in a single item.
As the following example shows, the sequence (from 1 to 2) of the existing modifier groups in the single item (300001
) is group_300001_01
and group_300001_02
.
{
"requestId": "202212071012340000002",
"appId": "210201011541660",
"store": {
"storeId": "20221001storeid04", // (Required) The store where the existing modifier group belongs
"menus": [
{
"menuId": "menu_id_01", // (Required) The menu where the existing modifier group belongs
"categories": [
{
"categoryId": "category_id_01", // (Required) The category where the existing modifier group belongs
"items": [
{
"itemId": "300001", // (Required) The item where the existing modifier group belongs
"modifierGroups": [
{
"groupId": "group_300001_01", // (Required) The existing modifier group to set sequence
"sequence":1 // (Optional) Specify this parameter if you want to sort the existing modifier group.
},
{
"groupId": "group_300001_02",
"sequence":2
}
]
}
]
}
]
}
]
}
}
Set sequence for reused modifier groups
You can also set a different sequence for existing modifier groups that are reused in a different single item.
As the following example shows, for the same modifier groups:
- The sequence (from 1 to 2) of the existing modifier groups in the single item (
300001
) isgroup_300001_01
andgroup_300001_02
. - The sequence (from 1 to 2) of the reused modifier groups in the single item (
300002
) isgroup_300001_02
andgroup_300001_01
.
{
"requestId": "202212071012340000002",
"appId": "210201011541660",
"store": {
"storeId": "20221001storeid04", // (Required) The store where the reused modifier group belongs
"menus": [
{
"menuId": "menu_id_01", // (Required) The menu where the reused modifier group belongs
"categories": [
{
"categoryId": "category_id_01", // (Required) The category where the reused modifier group belongs
"items": [
{
"itemId": "300001",
"modifierGroups": [
{
"groupId": "group_300001_01", // The existing modifier group
"sequence":1 // The sequence of the existing modifier group
},
{
"groupId": "group_300001_02",
"sequence":2
}
]
},
{
"itemId": "300002", // (Required) The item where the reused modifier group belongs
"modifierGroups": [
{
"groupId": "group_300001_01", // (Required) The reused modifier group to set sequence
"sequence":2 // (Optional) Specify this parameter if you want to sort the reused modifier group.
},
{
"groupId": "group_300001_02",
"sequence":1
}
]
}
]
}
]
}
]
}
}