0

我想创建一个具有以下表示的订单

{   
   /* basic order fields ... */
   // additional order fields 
    "destination": {
        "id": "000",
        "name": "xxx",
        "country": "AB"
    },
    "origin": {
        "id": "111",
        "name": "YYY",
        "country": "CD"
    },
    "account": {
        "holder": {
            "name": "name exampel",
            "gender": "gender example",
            "preferredCity": "some city"
        },
        "saldo": 30
    }
}

文档展示了我们如何创建订单类型,如果字段具有平面表示,这很好,但在我的情况下,我需要有一些嵌套级别。我考虑过先创建内部类型,然后在包含类型中使用它们,直到我到达根目录,但这对我不起作用。

这样做的正确方法是什么?

4

1 回答 1

-1

没有订单类型,但您可以在订单对象上创建自定义类型(带有自定义字段)。https://docs.commercetools.com/api/projects/orders#representations

对于支持的字段类型,您可以在这里查看:https ://docs.commercetools.com/api/projects/types#fieldtype

您是否查看过类型集或参考?通过类型引用,您可以链接到自定义对象(键值文档),您可以根据需要在其中存储 JSON 格式的数据。https://docs.commercetools.com/api/projects/custom-objects#customobject

于 2020-09-29T15:35:57.780 回答