Skip to content

UserAttributeInput ​

Type: schema

Description ​

A value to set for one attribute, named by its attribute_id or its slug (one of the two). Shoppers can set visible, active custom attributes that aren't is_readonly.

TypeScript Definition ​

typescript
UserAttributeInput: {{
            /** @description The attribute's `id`. */
            attribute_id: string;
            /** @description The value, of the attribute's `attribute_type`, at most 4 KB as JSON. `null`, an empty string or only spaces removes it. `[]` and `{}` are values. */
            value: string | number | boolean | unknown[] | Record<string, never> | null;
        } | {
            /** @description The attribute's `slug`. */
            slug: string;
            /** @description The value, of the attribute's `attribute_type`, at most 4 KB as JSON. `null`, an empty string or only spaces removes it. `[]` and `{}` are values. */
            value: string | number | boolean | unknown[] | Record<string, never> | null;
        };
        /**
         * UserAttributeValue
         * @description A customer attribute with the customer's value for it.
         */
}

OpenAPI Schema ​

json
{
  "title": "UserAttributeInput",
  "description": "A value to set for one attribute, named by its `attribute_id` or its `slug` (one of the two). Shoppers can set visible, active `custom` attributes that aren't `is_readonly`.",
  "externalDocs": {
    "url": "https://llm-docs.commercengine.io/storefront/schemas/UserAttributeInput",
    "description": "API reference for the UserAttributeInput schema"
  },
  "oneOf": [
    {
      "title": "By id",
      "type": "object",
      "properties": {
        "attribute_id": {
          "description": "The attribute's `id`.",
          "type": "string"
        },
        "value": {
          "description": "The value, of the attribute's `attribute_type`, at most 4 KB as JSON. `null`, an empty string or only spaces removes it. `[]` and `{}` are values.",
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "number"
            },
            {
              "type": "boolean"
            },
            {
              "type": "array"
            },
            {
              "type": "object"
            },
            {
              "type": "null"
            }
          ]
        }
      },
      "required": [
        "attribute_id",
        "value"
      ]
    },
    {
      "title": "By slug",
      "type": "object",
      "properties": {
        "slug": {
          "description": "The attribute's `slug`.",
          "type": "string"
        },
        "value": {
          "description": "The value, of the attribute's `attribute_type`, at most 4 KB as JSON. `null`, an empty string or only spaces removes it. `[]` and `{}` are values.",
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "number"
            },
            {
              "type": "boolean"
            },
            {
              "type": "array"
            },
            {
              "type": "object"
            },
            {
              "type": "null"
            }
          ]
        }
      },
      "required": [
        "slug",
        "value"
      ]
    }
  ]
}

Auto-generated from OpenAPI spec and TypeScript definitions

Last updated: