Skip to content

Variant ​

Type: schema

TypeScript Definition ​

typescript
Variant: {{
            /** @description variant id */
            id: string;
            /** @description product id */
            product_id: string;
            /** @description variant sku */
            sku: string | null;
            slug: string;
            /** @description variant name */
            name: string;
            /** @description variant name */
            product_name: string;
            short_description: string | null;
            active: $Read<boolean>;
            stock_available: $Read<boolean>;
            /** @description Indicates whether the item is being fulfilled as a backorder. When true, the item is not currently in stock and will ship later once inventory is available. This may result in the order being split into multiple shipments, with delays for the backordered portion. */
            backorder?: boolean;
            on_promotion: $Read<boolean>;
            on_subscription: $Read<boolean>;
            /** @description Indicates whether a variant is marked as the default variant for a product */
            is_default: $Read<boolean>;
            /** @description This object contains multiple dynamic keys. Each key is a string derived from the attribute key, and the value is an object of the type `AssociatedOption`. */
            associated_options: components["schemas"]["AssociatedOption"];
            images: components["schemas"]["ProductImage"][];
            videos: components["schemas"]["ProductVideo"][];
            /** @description Variant pricing for the applicable customer group. `null` when no pricing is configured for the variant. */
            pricing: components["schemas"]["ProductPricing"] | null;
            subscription: components["schemas"]["ProductSubscription"][];
            promotion: components["schemas"]["ProductPromotion"];
            /** @description Variant-level shipping configuration. Emitted by the standalone variant list/detail endpoints; `null` when no variant shipping is configured. Omitted from variants embedded in a product-listing payload. */
            shipping?: components["schemas"]["ProductShipping"] | null;
            /** @description Variant-level packing dimensions. Emitted by the standalone variant list/detail endpoints; `null` when none configured. Omitted from variants embedded in a product-listing payload. */
            packaging?: components["schemas"]["Packaging"];
            /** @description Freeform metadata key/value map. Emitted when the variant is returned inside a product-listing payload. */
            metadata?: {
                [key: string]: string;
            } | null;
            /** @description Indicates whether the variant currently has an active offer. */
            on_offer?: boolean;
            inventory?: components["schemas"]["LotBatchDetail"][];
        };
        /** VariantDetail */
}

Component References ​

ReferenceResolves To
components["schemas"]["AssociatedOption"]AssociatedOption
components["schemas"]["ProductImage"]ProductImage
components["schemas"]["ProductVideo"]ProductVideo
components["schemas"]["ProductPricing"]ProductPricing
components["schemas"]["ProductSubscription"]ProductSubscription
components["schemas"]["ProductPromotion"]ProductPromotion
components["schemas"]["ProductShipping"]ProductShipping
components["schemas"]["Packaging"]Packaging
components["schemas"]["LotBatchDetail"]LotBatchDetail

OpenAPI Schema ​

json
{
  "title": "ProductVariant",
  "type": "object",
  "externalDocs": {
    "url": "https://llm-docs.commercengine.io/storefront/schemas/Variant",
    "description": "API reference for the Variant schema"
  },
  "required": [
    "id",
    "product_id",
    "sku",
    "slug",
    "name",
    "product_name",
    "short_description",
    "active",
    "stock_available",
    "on_promotion",
    "on_subscription",
    "is_default",
    "associated_options",
    "images",
    "videos",
    "pricing",
    "subscription",
    "promotion"
  ],
  "properties": {
    "id": {
      "description": "variant id",
      "type": "string"
    },
    "product_id": {
      "description": "product id",
      "type": "string"
    },
    "sku": {
      "description": "variant sku",
      "type": [
        "string",
        "null"
      ]
    },
    "slug": {
      "type": "string"
    },
    "name": {
      "description": "variant name",
      "type": "string"
    },
    "product_name": {
      "description": "variant name",
      "type": "string"
    },
    "short_description": {
      "type": [
        "string",
        "null"
      ]
    },
    "active": {
      "type": "boolean",
      "readOnly": true
    },
    "stock_available": {
      "type": "boolean",
      "readOnly": true
    },
    "backorder": {
      "description": "Indicates whether the item is being fulfilled as a backorder. When true, the item is not currently in stock and will ship later once inventory is available. This may result in the order being split into multiple shipments, with delays for the backordered portion.",
      "type": "boolean"
    },
    "on_promotion": {
      "type": "boolean",
      "readOnly": true
    },
    "on_subscription": {
      "type": "boolean",
      "readOnly": true
    },
    "is_default": {
      "description": "Indicates whether a variant is marked as the default variant for a product",
      "type": "boolean",
      "readOnly": true
    },
    "associated_options": {
      "description": "This object contains multiple dynamic keys. Each key is a string derived from the attribute key, and the value is an object of the type `AssociatedOption`.",
      "$ref": "#/components/schemas/AssociatedOption"
    },
    "images": {
      "type": "array",
      "items": {
        "$ref": "#/components/schemas/ProductImage"
      }
    },
    "videos": {
      "type": "array",
      "items": {
        "$ref": "#/components/schemas/ProductVideo"
      }
    },
    "pricing": {
      "description": "Variant pricing for the applicable customer group. `null` when no pricing is configured for the variant.",
      "oneOf": [
        {
          "$ref": "#/components/schemas/ProductPricing"
        },
        {
          "type": "null"
        }
      ]
    },
    "subscription": {
      "type": "array",
      "items": {
        "$ref": "#/components/schemas/ProductSubscription"
      }
    },
    "promotion": {
      "$ref": "#/components/schemas/ProductPromotion"
    },
    "shipping": {
      "description": "Variant-level shipping configuration. Emitted by the standalone variant list/detail endpoints; `null` when no variant shipping is configured. Omitted from variants embedded in a product-listing payload.",
      "oneOf": [
        {
          "$ref": "#/components/schemas/ProductShipping"
        },
        {
          "type": "null"
        }
      ]
    },
    "packaging": {
      "description": "Variant-level packing dimensions. Emitted by the standalone variant list/detail endpoints; `null` when none configured. Omitted from variants embedded in a product-listing payload.",
      "$ref": "#/components/schemas/Packaging"
    },
    "metadata": {
      "description": "Freeform metadata key/value map. Emitted when the variant is returned inside a product-listing payload.",
      "type": [
        "object",
        "null"
      ],
      "additionalProperties": {
        "type": "string"
      }
    },
    "on_offer": {
      "description": "Indicates whether the variant currently has an active offer.",
      "type": "boolean"
    },
    "inventory": {
      "type": "array",
      "items": {
        "$ref": "#/components/schemas/LotBatchDetail"
      }
    }
  },
  "examples": []
}

Auto-generated from OpenAPI spec and TypeScript definitions

Last updated: