Skip to content

Coupon ​

Type: schema

TypeScript Definition ​

typescript
Coupon: {(components["schemas"]["DiscountCouponPromotion"] | components["schemas"]["FreeGoodCouponPromotion"] | components["schemas"]["FixedPriceCouponPromotion"] | components["schemas"]["BuyXGetYCouponPromotion"] | components["schemas"]["VolumeBasedCouponPromotion"] | (components["schemas"]["FreeShippingCouponPromotion"] & {
            /** @constant */
            coupon_type: "free-shipping"
}

Component References ​

ReferenceResolves To
components["schemas"]["DiscountCouponPromotion"]DiscountCouponPromotion
components["schemas"]["FreeGoodCouponPromotion"]FreeGoodCouponPromotion
components["schemas"]["FixedPriceCouponPromotion"]FixedPriceCouponPromotion
components["schemas"]["BuyXGetYCouponPromotion"]BuyXGetYCouponPromotion
components["schemas"]["VolumeBasedCouponPromotion"]VolumeBasedCouponPromotion
components["schemas"]["FreeShippingCouponPromotion"]FreeShippingCouponPromotion

OpenAPI Schema ​

json
{
  "title": "Coupon",
  "externalDocs": {
    "url": "https://llm-docs.commercengine.io/storefront/schemas/Coupon",
    "description": "API reference for the Coupon schema"
  },
  "allOf": [
    {
      "oneOf": [
        {
          "$ref": "#/components/schemas/DiscountCouponPromotion"
        },
        {
          "$ref": "#/components/schemas/FreeGoodCouponPromotion"
        },
        {
          "$ref": "#/components/schemas/FixedPriceCouponPromotion"
        },
        {
          "$ref": "#/components/schemas/BuyXGetYCouponPromotion"
        },
        {
          "$ref": "#/components/schemas/VolumeBasedCouponPromotion"
        },
        {
          "allOf": [
            {
              "$ref": "#/components/schemas/FreeShippingCouponPromotion"
            },
            {
              "type": "object",
              "required": [
                "coupon_type"
              ],
              "properties": {
                "coupon_type": {
                  "const": "free-shipping"
                }
              }
            }
          ]
        },
        {
          "$ref": "#/components/schemas/AcceleratedRewardCouponPromotion"
        },
        {
          "$ref": "#/components/schemas/TieredDiscountCouponPromotion"
        }
      ]
    },
    {
      "type": "object",
      "required": [
        "coupon_type",
        "coupon_code",
        "application_rules",
        "can_be_used_with_promotion",
        "status",
        "active",
        "coupon_code_count",
        "terms_and_conditions",
        "can_earn_loyalty_points",
        "can_redeem_loyalty_points",
        "customer_eligibility",
        "customer_id",
        "customer_id_count",
        "customer_group_id",
        "customer_group_id_count",
        "product_id",
        "product_id_count",
        "category_id",
        "category_id_count"
      ],
      "properties": {
        "coupon_type": {
          "enum": [
            "discount",
            "free-goods",
            "fixed-price",
            "free-shipping",
            "buy-x-get-y",
            "volume-based",
            "accelerated-rewards",
            "tiered-discount"
          ]
        },
        "coupon_code": {
          "type": "array",
          "items": {
            "type": "string"
          }
        },
        "application_rules": {
          "description": "How many of the cart's items the coupon applies to, and which first; both `null` when not limited.",
          "type": [
            "object",
            "null"
          ],
          "properties": {
            "max_applicable_items": {
              "type": [
                "integer",
                "null"
              ]
            },
            "application_priority": {
              "enum": [
                "cheapest_first",
                "most_expensive_first",
                "first_added",
                null
              ]
            }
          },
          "required": [
            "max_applicable_items",
            "application_priority"
          ]
        },
        "can_be_used_with_promotion": {
          "type": "boolean"
        },
        "status": {
          "description": "`inactive` once it is deactivated or has expired.",
          "type": "string",
          "enum": [
            "draft",
            "active",
            "inactive"
          ]
        },
        "active": {
          "description": "Whether it can be used: `true` while `status` is `active`.",
          "type": "boolean"
        },
        "coupon_code_count": {
          "description": "How many codes the coupon has; `coupon_code` lists the first 25, in the order they were added.",
          "type": "integer"
        },
        "terms_and_conditions": {
          "description": "The coupon's terms in words (its validity, per-customer limit and minimum order value); `null` when there are none.",
          "type": [
            "string",
            "null"
          ]
        },
        "can_earn_loyalty_points": {
          "description": "Whether an order using it earns loyalty points.",
          "type": "boolean"
        },
        "can_redeem_loyalty_points": {
          "description": "Whether an order using it can redeem loyalty points.",
          "type": "boolean"
        },
        "customer_eligibility": {
          "description": "Who it applies to.",
          "enum": [
            "all",
            "customer",
            "customer-group"
          ]
        },
        "customer_id": {
          "description": "Customers it is for, when `customer_eligibility` is `customer`.",
          "type": "array",
          "items": {
            "type": "string"
          }
        },
        "customer_id_count": {
          "description": "How many customers the coupon is for; `customer_id` lists the first 100, in the order they were added.",
          "type": "integer"
        },
        "customer_group_id": {
          "description": "Customer groups it is for, when `customer_eligibility` is `customer-group`.",
          "type": "array",
          "items": {
            "type": "string"
          }
        },
        "customer_group_id_count": {
          "description": "How many customer groups the coupon is for; `customer_group_id` lists the first 100, in the order they were added.",
          "type": "integer"
        },
        "product_id": {
          "description": "Products listed on it.",
          "type": "array",
          "items": {
            "type": "string"
          }
        },
        "product_id_count": {
          "description": "How many products are listed on the coupon; `product_id` lists the first 100, in the order they were added.",
          "type": "integer"
        },
        "category_id": {
          "description": "Categories listed on it.",
          "type": "array",
          "items": {
            "type": "string"
          }
        },
        "category_id_count": {
          "description": "How many categories are listed on the coupon; `category_id` lists the first 100, in the order they were added.",
          "type": "integer"
        }
      }
    }
  ]
}

Auto-generated from OpenAPI spec and TypeScript definitions

Last updated: