Skip to content

BuyXGetYRuleBasedOnQuantity

Type: schema

Description

Additional fields required in addition to marked as required.

  1. buy_product_id or buy_variant_id or buy_from_category_id
  2. get_product_id or get_variant_id or get_from_category_id
  3. get_free_quantity or get_discount_percent

TypeScript Definition

typescript
BuyXGetYRuleBasedOnQuantity: {{
            /** @constant */
            spending_criteria_type: "minimum-quantity";
            products: {
                minimum_quantity: number;
                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;
            }[];
            /** @description It can be null for get_offer_type = free */
            maximum_discount_amount: number | null;
        };
        /**
         * CardPayment
         * @description Payments using credit card, debit card
         */
}

OpenAPI Schema

json
{
  "title": "BuyXGetYRuleBasedOnQuantity",
  "description": "Additional fields required in addition to marked as required.\n1) buy_product_id or buy_variant_id or buy_from_category_id\n2) get_product_id or get_variant_id or get_from_category_id\n3) get_free_quantity or get_discount_percent",
  "type": "object",
  "externalDocs": {
    "url": "https://llm-docs.commercengine.io/storefront/schemas/BuyXGetYRuleBasedOnQuantity",
    "description": "API reference for the BuyXGetYRuleBasedOnQuantity schema"
  },
  "required": [
    "spending_criteria_type",
    "products",
    "maximum_discount_amount"
  ],
  "properties": {
    "spending_criteria_type": {
      "type": "string",
      "const": "minimum-quantity"
    },
    "products": {
      "type": "array",
      "items": {
        "type": "object",
        "required": [
          "minimum_quantity",
          "buy_product_id",
          "buy_variant_id",
          "buy_from_category_id",
          "get_product_id",
          "get_variant_id",
          "get_from_category_id",
          "get_quantity",
          "get_offer_type",
          "get_discount_percent"
        ],
        "properties": {
          "minimum_quantity": {
            "type": "integer",
            "minimum": 1
          },
          "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"
            ]
          }
        }
      }
    },
    "maximum_discount_amount": {
      "description": "It can be null for get_offer_type = free",
      "type": [
        "number",
        "null"
      ]
    }
  }
}

Auto-generated from OpenAPI spec and TypeScript definitions

Last updated: