Skip to content

ProductPromotion

Type: schema

Description

Active promotion on a product. null when on_promotion is false. The details field uses promotion_type as discriminator to determine the promotion structure.

TypeScript Definition

typescript
ProductPromotion: {{
            id: string;
            /** Format: date-time */
            starts_at: string;
            /**
             * Format: date-time
             * @description When the promotion ends. `null` for promotions with no expiry.
             */
            expires_at: string | null;
            /** @description Promotion rules and pricing. Use `promotion_type` to determine the structure: `discount` (percentage/flat off), `fixed-price` (override price), `volume-based` (buy X at Y price), or `free-goods` (buy X get Y free). */
            details: components["schemas"]["DiscountBasedPromotion"] | components["schemas"]["FixedPricePromotion"] | components["schemas"]["VolumeBasedPromotion"] | components["schemas"]["FreeGoodsPromotion"];
        } | null;
        /** ProductReview */
}

Component References

ReferenceResolves To
components["schemas"]["DiscountBasedPromotion"]DiscountBasedPromotion
components["schemas"]["FixedPricePromotion"]FixedPricePromotion
components["schemas"]["VolumeBasedPromotion"]VolumeBasedPromotion
components["schemas"]["FreeGoodsPromotion"]FreeGoodsPromotion

OpenAPI Schema

json
{
  "title": "ProductPromotion",
  "description": "Active promotion on a product. `null` when `on_promotion` is `false`. The `details` field uses `promotion_type` as discriminator to determine the promotion structure.",
  "type": [
    "object",
    "null"
  ],
  "externalDocs": {
    "url": "https://llm-docs.commercengine.io/storefront/schemas/ProductPromotion",
    "description": "API reference for the ProductPromotion schema"
  },
  "required": [
    "id",
    "starts_at",
    "expires_at",
    "details"
  ],
  "properties": {
    "id": {
      "type": "string"
    },
    "starts_at": {
      "type": "string",
      "format": "date-time"
    },
    "expires_at": {
      "description": "When the promotion ends. `null` for promotions with no expiry.",
      "type": [
        "string",
        "null"
      ],
      "format": "date-time"
    },
    "details": {
      "description": "Promotion rules and pricing. Use `promotion_type` to determine the structure: `discount` (percentage/flat off), `fixed-price` (override price), `volume-based` (buy X at Y price), or `free-goods` (buy X get Y free).",
      "discriminator": {
        "propertyName": "promotion_type",
        "mapping": {
          "discount": "#/components/schemas/DiscountBasedPromotion",
          "fixed-price": "#/components/schemas/FixedPricePromotion",
          "volume-based": "#/components/schemas/VolumeBasedPromotion",
          "free-goods": "#/components/schemas/FreeGoodsPromotion"
        }
      },
      "oneOf": [
        {
          "$ref": "#/components/schemas/DiscountBasedPromotion"
        },
        {
          "$ref": "#/components/schemas/FixedPricePromotion"
        },
        {
          "$ref": "#/components/schemas/VolumeBasedPromotion"
        },
        {
          "$ref": "#/components/schemas/FreeGoodsPromotion"
        }
      ]
    }
  }
}

Auto-generated from OpenAPI spec and TypeScript definitions

Last updated: