Set seasonal pricing

This topic demonstrates the implementations of the syncStore API for specifying different prices for an item or SKU.

Overview

You can set different prices for an item or SKU if the price changes during particular seasons or periods.

Use cases

Set seasonal item pricing

To set seasonal pricing for an item, specify the items.bizRules.scene parameter as PRICE_SCHEDULE and the ruleData parameter with specific price rules.

Note: The time in the timeSlot parameter must follow the 24-hour HH:MM format with time zone.

See the following example:

  • From 2022-09-21T00:00:01+08:00 to 2022-12-31T01:00:01+08:00, the original price of the item (item_01) is SGD 2 from 10: 00 to 14: 00 on Mondays, Tuesdays, and Wednesdays.
  • From 2022-09-21T00:00:01+08:00 to 2022-12-31T01:00:01+08:00, the actual price of the item (item_01) is SGD 1.8 from 10: 00 to 14: 00 on Mondays, Tuesdays, and Wednesdays.
copy
{
    "requestId": "20221122211***",
    "appId": "21020101154***",
    "store": {
        "storeId": "20221017storeid01",
        "menus": [
            {
                "menuId": "menu_id_01",
                "categories": [
                    {
                        "categoryId": "category_id_01",
                        "items": [
                            {
                                "itemId": "item_01",
                                "bizRules": [
                                    {
                                        "scene": "PRICE_SCHEDULE",
                                        "ruleData": "[{\"from\": \"2022-09-21T00:00:01+08:00\",\"to\": \"2022-12-31T23:59:59+08:00\",\"weekDays\": [\"MONDAY\",\"WEDNESDAY\",\"TUESDAY\"],\"timeSlot\": {\"startTime\": \"10:00+08:00\",\"endTime\": \"14:00+08:00\"},\"originAmount\":200,\"saleAmount\":180,\"currency\": \"SGD\"}]"
                                    }
                                ]
                            }
                        ]
                    }
                ]
            }
        ]
    }
}

The following example demonstrates the above ruleData parameter value before serialization:

copy
[
    {
        "from": "2022-09-21T00:00:01+08:00",
        "to": "2022-12-31T01:00:01+08:00",
        "weekDays": [
            "MONDAY",
            "WEDNESDAY",
            "TUESDAY"
        ],
        "timeSlot": {
            "startTime": "10:00+08:00",
            "endTime": "14:00+08:00"
        },
        "originAmount": 200,
        "saleAmount": 180,
        "currency": "SGD"
    }
]

Set seasonal SKU pricing

To set seasonal pricing for an SKU, specify the skus.bizRules.scene parameter as PRICE_SCHEDULE and the ruleData parameter with specific price rules.

Note: Be sure to pass both the skus and skuPropertyGroups arrays. For more information about key-value pairs in the skus.skuPropertyPairs parameter, see Change skus or skuPropertyGroups.

See the following example:

  • From 2022-09-21T00:00:01+08:00 to 2022-12-31T23:59:59+08:00, the original price of the SKU (tsku2121) is SGD 2 from 10: 00 to 14: 00 on Mondays, Tuesdays, and Wednesdays.
  • From 2022-09-21T00:00:01+08:00 to 2022-12-31T23:59:59+08:00, the actual price of the SKU (tsku2121) is SGD 1.8 from 10: 00 to 14: 00 on Mondays, Tuesdays, and Wednesdays.

copy
{
    "requestId": "20221122211***",
    "appId": "21020101154***",
    "store": {
        "storeId": "20221017storeid01",
        "menus": [
            {
                "menuId": "menu_id_01",
                "categories": [
                    {
                        "categoryId": "category_id_01",
                        "items": [
                            {
                                "itemId": "item_01",
                                "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
                                        },
                                        "bizRules": [
                                            {
                                                "scene": "PRICE_SCHEDULE",
                                                "ruleData": "[{\"from\": \"2022-09-21T00:00:01+08:00\",\"to\": \"2022-12-31T23:59:59+08:00\",\"weekDays\": [\"MONDAY\",\"WEDNESDAY\",\"TUESDAY\"],\"timeSlot\": {\"startTime\": \"10:00+08:00\",\"endTime\": \"14:00+08:00\"},\"originAmount\":200,\"saleAmount\":180,\"currency\": \"SGD\"}]"
                                            }
                                        ],
                                        "contents": [
                                            {
                                                "type": "IMAGE",
                                                "scene": "BACKGROUND",
                                                "value": "https://www.example.com/images/uploads/meals/test.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/test.png"
                                            }
                                        ]
                                    }
                                ]
                            }
                        ]
                    }
                ]
            }
        ]
    }
}