You can use the updateItemType endpoint in the Commerce Cloud Admin API to add custom properties to the commerceItem item type. When you add a custom property to the commerceItem item type, the property is added to all line items in all orders.

The following example illustrates using the updateItemType endpoint to add a custom property. Note that the request header must specify the x-ccasset-language value:

PUT /ccadmin/v1/itemTypes/commerceItem  HTTP/1.1
Authorization: Bearer <access_token>
x-ccasset-language: en

{
  "id": "commerceItem",
  "specifications": [
    {
       "id": "monogram",
       "label": "Initials for monogramming",
       "type": "shortText",
       "uiEditorType": "shortText",
       "internalOnly": false,
       "required": false,
       "default": null
    }
  ]
}

The response includes the custom property you added:

...
{
      "length": 254,
      "label": "Initials for monogramming",
      "type": "shortText",
      "required": false,
      "searchable": false,
      "writable": true,
      "internalOnly": false,
      "uiEditorType": "shortText",
      "default": null,
      "audienceVisibility": null,
      "localizable": false,
      "textSearchable": false,
      "id": "monogram",
      "dimension": false,
      "multiSelect": null,
      "editableAttributes": [
        "internalOnly",
        "default",
        "audienceVisibility",
        "textSearchable",
        "label",
        "dimension",
        "required",
        "searchable",
        "multiSelect"
      ]
    }
...

Note that for a commerceItem custom property, you will typically want to set default to null and required to false, so that the property is not set unless the shopper explicitly chooses to set it.


Copyright © 1997, 2017 Oracle and/or its affiliates. All rights reserved. Legal Notices