Skip to content

VariantOption

Type: schema

TypeScript Definition

typescript
VariantOption: {{
            /** @description The name of the associated option. */
            name: string;
            /** @description A lookup safe version of the name that is lowercased and spaces are replaced with underscores. For instance, if name is `Product Type`, key will be `product_type` */
            key: string;
            /** @enum {string} */
            type: "single-select" | "color";
            /**
             * @description When option_type is color, value will contain an array of objects like:
             *     ```json
             *     [
             *         {
             *         "name": "first_color",
             *         "hexcode": "#000000"
             *         },
             *         {
             *         "name": "second_color",
             *         "hexcode": "#FFFFFF"
             *         }
             *     ]
             *     ```
             */
            value: (string | Record<string, never>)[];
        };
        /** VolumeBasedCouponPromotion */
}

OpenAPI Schema

json
{
  "title": "VariantOption",
  "type": "object",
  "externalDocs": {
    "url": "https://llm-docs.commercengine.io/storefront/schemas/VariantOption",
    "description": "API reference for the VariantOption schema"
  },
  "required": [
    "name",
    "key",
    "type",
    "value"
  ],
  "properties": {
    "name": {
      "description": "The name of the associated option.",
      "type": "string"
    },
    "key": {
      "description": "A lookup safe version of the name that is lowercased and spaces are replaced with underscores. For instance, if name is `Product Type`, key will be `product_type`",
      "type": "string"
    },
    "type": {
      "type": "string",
      "enum": [
        "single-select",
        "color"
      ]
    },
    "value": {
      "description": "When option_type is color, value will contain an array of objects like:\n```json\n[\n    {\n    \"name\": \"first_color\",\n    \"hexcode\": \"#000000\"\n    },\n    {\n    \"name\": \"second_color\",\n    \"hexcode\": \"#FFFFFF\"\n    }\n]\n```",
      "type": "array",
      "items": {
        "oneOf": [
          {
            "type": "string"
          },
          {
            "type": "object"
          }
        ]
      }
    }
  }
}

Auto-generated from OpenAPI spec and TypeScript definitions

Last updated: