Skip to content

AvailablePromotion ​

Type: schema

Description ​

A promotion available to the current customer and cart.

TypeScript Definition ​

typescript
AvailablePromotion: {{
            id: string;
            name: string;
            description: string | null;
            tags: string[] | null;
            redemption_limits: {
                total_redemptions: number | null;
                per_customer_redemptions: number | null;
                per_coupon_code_redemptions: number | null;
            };
            redemption_count: number;
            minimum_order_total: number | null;
            /** Format: date-time */
            starts_at: string | null;
            /** Format: date-time */
            expires_at: string | null;
            details: {
                discount_type: string | null;
                discount_percent: number | null;
                maximum_discount_amount: number | null;
                products: {
                    product_id?: string | null;
                    variant_id?: string | null;
                    minimum_quantity?: number | null;
                    maximum_quantity?: number | null;
                    minimum_value?: number | null;
                    maximum_value?: number | null;
                }[];
                category_id: string[];
                sellers: string[];
                fixed_discount_amount: number;
            } & {
                [key: string]: unknown;
            };
            /** @description Scope of the promotion. Defaults to `all`. */
            applies_to_product: string;
            promotion_type: string;
            can_be_used_with_other_promotion: boolean;
        } & ({
            /** @constant */
            promotion_type: "discount";
            details?: {
                discount_type?: string | null;
                discount_percent?: number | null;
                maximum_discount_amount?: number | null;
                products?: {
                    product_id?: string | null;
                    variant_id?: string | null;
                    minimum_quantity?: number | null;
                    maximum_quantity?: number | null;
                    minimum_value?: number | null;
                    maximum_value?: number | null;
                }[];
                category_id?: string[];
                sellers?: string[];
                fixed_discount_amount?: number;
            } & {
                [key: string]: unknown;
            };
        } | {
            /** @constant */
            promotion_type: "free-goods";
            details?: {
                discount_type?: string | null;
                discount_percent?: number | null;
                maximum_discount_amount?: number | null;
                products?: {
                    product_id?: string | null;
                    variant_id?: string | null;
                    minimum_quantity?: number | null;
                    maximum_quantity?: number | null;
                    minimum_value?: number | null;
                    maximum_value?: number | null;
                    auto_scale?: boolean;
                    slab?: {
                        buy_quantity?: number;
                        get_quantity?: number;
                    };
                    slabs?: {
                        [key: string]: unknown;
                    }[];
                }[];
                category_id?: string[];
                sellers?: string[];
                fixed_discount_amount?: number;
            } & {
                [key: string]: unknown;
            };
        } | {
            /** @constant */
            promotion_type: "volume-based";
            details?: {
                discount_type?: string | null;
                discount_percent?: number | null;
                maximum_discount_amount?: number | null;
                products?: {
                    product_id?: string | null;
                    variant_id?: string | null;
                    minimum_quantity?: number | null;
                    maximum_quantity?: number | null;
                    minimum_value?: number | null;
                    maximum_value?: number | null;
                    slabs?: {
                        [key: string]: unknown;
                    }[];
                }[];
                category_id?: string[];
                sellers?: string[];
                fixed_discount_amount?: number;
            } & {
                [key: string]: unknown;
            };
        } | {
            /** @constant */
            promotion_type: "buy-x-get-y";
            details?: {
                discount_type?: string | null;
                discount_percent?: number | null;
                maximum_discount_amount?: number | null;
                products?: {
                    minimum_quantity?: number;
                    minimum_purchase_amount?: number | null;
                    buy_product_id?: string | null;
                    buy_variant_id?: string | null;
                    buy_from_category_id?: string | null;
                    get_product_id?: string | null;
                    get_variant_id?: string | null;
                    get_from_category_id?: string | null;
                    get_quantity?: number;
                    /** @enum {unknown} */
                    get_offer_type?: "discount" | "free";
                    /** @description It can be null for get_offer_type = free */
                    get_discount_percent?: number | null;
                }[];
                category_id?: string[];
                sellers?: string[];
                fixed_discount_amount?: number;
            } & {
                [key: string]: unknown;
            };
        } | {
            /** @constant */
            promotion_type: "free-shipping";
            details?: {
                discount_type?: string | null;
                discount_percent?: number | null;
                maximum_discount_amount?: number | null;
                products?: {
                    product_id?: string | null;
                    variant_id?: string | null;
                    minimum_quantity?: number | null;
                    maximum_quantity?: number | null;
                    minimum_value?: number | null;
                    maximum_value?: number | null;
                }[];
                category_id?: string[];
                sellers?: string[];
                fixed_discount_amount?: number;
            } & {
                [key: string]: unknown;
            };
        });
        /**
         * BankTransfer
         * @description Bank transfer payment - IMPS, NEFT, RTGS
         */
}

OpenAPI Schema ​

json
{
  "title": "AvailablePromotion",
  "description": "A promotion available to the current customer and cart.",
  "type": "object",
  "externalDocs": {
    "url": "https://llm-docs.commercengine.io/storefront/schemas/AvailablePromotion",
    "description": "API reference for the AvailablePromotion schema"
  },
  "required": [
    "id",
    "name",
    "promotion_type",
    "description",
    "tags",
    "redemption_limits",
    "redemption_count",
    "minimum_order_total",
    "starts_at",
    "expires_at",
    "details",
    "applies_to_product",
    "can_be_used_with_other_promotion"
  ],
  "properties": {
    "id": {
      "type": "string"
    },
    "name": {
      "type": "string"
    },
    "description": {
      "type": [
        "string",
        "null"
      ]
    },
    "tags": {
      "type": [
        "array",
        "null"
      ],
      "items": {
        "type": "string"
      }
    },
    "redemption_limits": {
      "type": "object",
      "properties": {
        "total_redemptions": {
          "type": [
            "integer",
            "null"
          ]
        },
        "per_customer_redemptions": {
          "type": [
            "integer",
            "null"
          ]
        },
        "per_coupon_code_redemptions": {
          "type": [
            "integer",
            "null"
          ]
        }
      },
      "required": [
        "total_redemptions",
        "per_customer_redemptions",
        "per_coupon_code_redemptions"
      ]
    },
    "redemption_count": {
      "type": "integer"
    },
    "minimum_order_total": {
      "type": [
        "number",
        "null"
      ]
    },
    "starts_at": {
      "type": [
        "string",
        "null"
      ],
      "format": "date-time"
    },
    "expires_at": {
      "type": [
        "string",
        "null"
      ],
      "format": "date-time"
    },
    "details": {
      "type": "object",
      "additionalProperties": true,
      "properties": {
        "discount_type": {
          "type": [
            "string",
            "null"
          ]
        },
        "discount_percent": {
          "type": [
            "number",
            "null"
          ]
        },
        "maximum_discount_amount": {
          "type": [
            "number",
            "null"
          ]
        },
        "products": {
          "type": "array",
          "items": {
            "type": "object",
            "properties": {
              "product_id": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "variant_id": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "minimum_quantity": {
                "type": [
                  "number",
                  "null"
                ]
              },
              "maximum_quantity": {
                "type": [
                  "number",
                  "null"
                ]
              },
              "minimum_value": {
                "type": [
                  "number",
                  "null"
                ]
              },
              "maximum_value": {
                "type": [
                  "number",
                  "null"
                ]
              }
            }
          }
        },
        "category_id": {
          "type": "array",
          "items": {
            "type": "string"
          }
        },
        "sellers": {
          "type": "array",
          "items": {
            "type": "string"
          }
        },
        "fixed_discount_amount": {
          "type": "number"
        }
      },
      "required": [
        "discount_type",
        "discount_percent",
        "maximum_discount_amount",
        "fixed_discount_amount",
        "products",
        "category_id",
        "sellers"
      ]
    },
    "applies_to_product": {
      "description": "Scope of the promotion. Defaults to `all`.",
      "type": "string"
    },
    "promotion_type": {
      "type": "string"
    },
    "can_be_used_with_other_promotion": {
      "type": "boolean"
    }
  },
  "oneOf": [
    {
      "type": "object",
      "properties": {
        "promotion_type": {
          "type": "string",
          "const": "discount"
        },
        "details": {
          "type": "object",
          "additionalProperties": true,
          "properties": {
            "discount_type": {
              "type": [
                "string",
                "null"
              ]
            },
            "discount_percent": {
              "type": [
                "number",
                "null"
              ]
            },
            "maximum_discount_amount": {
              "type": [
                "number",
                "null"
              ]
            },
            "products": {
              "type": "array",
              "items": {
                "type": "object",
                "properties": {
                  "product_id": {
                    "type": [
                      "string",
                      "null"
                    ]
                  },
                  "variant_id": {
                    "type": [
                      "string",
                      "null"
                    ]
                  },
                  "minimum_quantity": {
                    "type": [
                      "number",
                      "null"
                    ]
                  },
                  "maximum_quantity": {
                    "type": [
                      "number",
                      "null"
                    ]
                  },
                  "minimum_value": {
                    "type": [
                      "number",
                      "null"
                    ]
                  },
                  "maximum_value": {
                    "type": [
                      "number",
                      "null"
                    ]
                  }
                }
              }
            },
            "category_id": {
              "type": "array",
              "items": {
                "type": "string"
              }
            },
            "sellers": {
              "type": "array",
              "items": {
                "type": "string"
              }
            },
            "fixed_discount_amount": {
              "type": "number"
            }
          }
        }
      },
      "required": [
        "promotion_type"
      ]
    },
    {
      "type": "object",
      "properties": {
        "promotion_type": {
          "type": "string",
          "const": "free-goods"
        },
        "details": {
          "type": "object",
          "additionalProperties": true,
          "properties": {
            "discount_type": {
              "type": [
                "string",
                "null"
              ]
            },
            "discount_percent": {
              "type": [
                "number",
                "null"
              ]
            },
            "maximum_discount_amount": {
              "type": [
                "number",
                "null"
              ]
            },
            "products": {
              "type": "array",
              "items": {
                "type": "object",
                "properties": {
                  "product_id": {
                    "type": [
                      "string",
                      "null"
                    ]
                  },
                  "variant_id": {
                    "type": [
                      "string",
                      "null"
                    ]
                  },
                  "minimum_quantity": {
                    "type": [
                      "number",
                      "null"
                    ]
                  },
                  "maximum_quantity": {
                    "type": [
                      "number",
                      "null"
                    ]
                  },
                  "minimum_value": {
                    "type": [
                      "number",
                      "null"
                    ]
                  },
                  "maximum_value": {
                    "type": [
                      "number",
                      "null"
                    ]
                  },
                  "auto_scale": {
                    "type": "boolean"
                  },
                  "slab": {
                    "type": "object",
                    "properties": {
                      "buy_quantity": {
                        "type": "number"
                      },
                      "get_quantity": {
                        "type": "number"
                      }
                    }
                  },
                  "slabs": {
                    "type": "array",
                    "items": {
                      "type": "object",
                      "additionalProperties": true
                    }
                  }
                }
              }
            },
            "category_id": {
              "type": "array",
              "items": {
                "type": "string"
              }
            },
            "sellers": {
              "type": "array",
              "items": {
                "type": "string"
              }
            },
            "fixed_discount_amount": {
              "type": "number"
            }
          }
        }
      },
      "required": [
        "promotion_type"
      ]
    },
    {
      "type": "object",
      "properties": {
        "promotion_type": {
          "type": "string",
          "const": "volume-based"
        },
        "details": {
          "type": "object",
          "additionalProperties": true,
          "properties": {
            "discount_type": {
              "type": [
                "string",
                "null"
              ]
            },
            "discount_percent": {
              "type": [
                "number",
                "null"
              ]
            },
            "maximum_discount_amount": {
              "type": [
                "number",
                "null"
              ]
            },
            "products": {
              "type": "array",
              "items": {
                "type": "object",
                "properties": {
                  "product_id": {
                    "type": [
                      "string",
                      "null"
                    ]
                  },
                  "variant_id": {
                    "type": [
                      "string",
                      "null"
                    ]
                  },
                  "minimum_quantity": {
                    "type": [
                      "number",
                      "null"
                    ]
                  },
                  "maximum_quantity": {
                    "type": [
                      "number",
                      "null"
                    ]
                  },
                  "minimum_value": {
                    "type": [
                      "number",
                      "null"
                    ]
                  },
                  "maximum_value": {
                    "type": [
                      "number",
                      "null"
                    ]
                  },
                  "slabs": {
                    "type": "array",
                    "items": {
                      "type": "object",
                      "additionalProperties": true
                    }
                  }
                }
              }
            },
            "category_id": {
              "type": "array",
              "items": {
                "type": "string"
              }
            },
            "sellers": {
              "type": "array",
              "items": {
                "type": "string"
              }
            },
            "fixed_discount_amount": {
              "type": "number"
            }
          }
        }
      },
      "required": [
        "promotion_type"
      ]
    },
    {
      "type": "object",
      "properties": {
        "promotion_type": {
          "type": "string",
          "const": "buy-x-get-y"
        },
        "details": {
          "type": "object",
          "additionalProperties": true,
          "properties": {
            "discount_type": {
              "type": [
                "string",
                "null"
              ]
            },
            "discount_percent": {
              "type": [
                "number",
                "null"
              ]
            },
            "maximum_discount_amount": {
              "type": [
                "number",
                "null"
              ]
            },
            "products": {
              "type": "array",
              "items": {
                "type": "object",
                "properties": {
                  "minimum_quantity": {
                    "type": "integer",
                    "minimum": 1
                  },
                  "minimum_purchase_amount": {
                    "type": [
                      "number",
                      "null"
                    ]
                  },
                  "buy_product_id": {
                    "type": [
                      "string",
                      "null"
                    ]
                  },
                  "buy_variant_id": {
                    "type": [
                      "string",
                      "null"
                    ]
                  },
                  "buy_from_category_id": {
                    "type": [
                      "string",
                      "null"
                    ]
                  },
                  "get_product_id": {
                    "type": [
                      "string",
                      "null"
                    ]
                  },
                  "get_variant_id": {
                    "type": [
                      "string",
                      "null"
                    ]
                  },
                  "get_from_category_id": {
                    "type": [
                      "string",
                      "null"
                    ]
                  },
                  "get_quantity": {
                    "type": "integer",
                    "minimum": 1
                  },
                  "get_offer_type": {
                    "enum": [
                      "discount",
                      "free"
                    ]
                  },
                  "get_discount_percent": {
                    "description": "It can be null for get_offer_type = free",
                    "type": [
                      "number",
                      "null"
                    ]
                  }
                }
              }
            },
            "category_id": {
              "type": "array",
              "items": {
                "type": "string"
              }
            },
            "sellers": {
              "type": "array",
              "items": {
                "type": "string"
              }
            },
            "fixed_discount_amount": {
              "type": "number"
            }
          }
        }
      },
      "required": [
        "promotion_type"
      ]
    },
    {
      "type": "object",
      "properties": {
        "promotion_type": {
          "type": "string",
          "const": "free-shipping"
        },
        "details": {
          "type": "object",
          "additionalProperties": true,
          "properties": {
            "discount_type": {
              "type": [
                "string",
                "null"
              ]
            },
            "discount_percent": {
              "type": [
                "number",
                "null"
              ]
            },
            "maximum_discount_amount": {
              "type": [
                "number",
                "null"
              ]
            },
            "products": {
              "type": "array",
              "items": {
                "type": "object",
                "properties": {
                  "product_id": {
                    "type": [
                      "string",
                      "null"
                    ]
                  },
                  "variant_id": {
                    "type": [
                      "string",
                      "null"
                    ]
                  },
                  "minimum_quantity": {
                    "type": [
                      "number",
                      "null"
                    ]
                  },
                  "maximum_quantity": {
                    "type": [
                      "number",
                      "null"
                    ]
                  },
                  "minimum_value": {
                    "type": [
                      "number",
                      "null"
                    ]
                  },
                  "maximum_value": {
                    "type": [
                      "number",
                      "null"
                    ]
                  }
                }
              }
            },
            "category_id": {
              "type": "array",
              "items": {
                "type": "string"
              }
            },
            "sellers": {
              "type": "array",
              "items": {
                "type": "string"
              }
            },
            "fixed_discount_amount": {
              "type": "number"
            }
          }
        }
      },
      "required": [
        "promotion_type"
      ]
    }
  ]
}

Auto-generated from OpenAPI spec and TypeScript definitions

Last updated: