The "apifm" product SKU in the traditional e-commerce model is difficult to meet the taste/garnishing model in the catering field. This tutorial explains how to implement another type of "SKU" in the catering model.
Let’s take the purchase of the product “Braised Chicken Rice” as an example:
When users order braised chicken and rice, they can have the following options:
+ Specifications
There is a difference between large portions and small portions. This is a required item. Users must choose whether they are large portions or small portions because the prices of large portions and small portions are different;
+ taste
Flavor is also a must, but it does not affect the price. For example, there are: not spicy, slightly spicy, medium spicy, extra spicy
+ side dishes
Side dishes are optional items. Users can choose according to their actual needs, and they support multiple selections. For example, users can add vegetables, add a thousand pieces, and add eggs. The selection will affect the price. The total price needs to be added to the price of the selected side dishes.
It is difficult to meet the above business needs through the product sku/specification size under the traditional e-commerce model.
The newly launched "optional accessories" function of "apifm" can realize the above functional requirements:
# Configure product optional accessories

Product management, add optional accessory information to a product:

# Get all optional accessories of the product on the front end

# Order interface adjustment
To create an order interface, the goodsJsonStr parameter needs to be passed in the side dish information purchased by the user:
Original parameters:
```json
[
{
"goodsId": 235853,
"number": 1,
"propertyChildIds": "",
"logisticsType": 0,
"inviter_id": 0
}
]
```
In this parameter, add the side dish information parameter: goodsAdditionList as follows:
```json
[
{
"goodsId": 235853,
"number": 1,
"propertyChildIds": "",
"logisticsType": 0,
"inviter_id": 0,
"goodsAdditionList": [
{
"id": 4,
"pid": 7
},
{
"id": 9,
"pid": 9
}
]
}
]
```
goodsAdditionList contains the side dish information selected by the user, including two sub-parameters:
+ id is the id of the side dish item
+ pid is the group id of the side dish item
As many items as the user selects, just concatenate them all into an array and pass them in.