Importing Coupons and Discount Rules

Fields

STANDARD FIELDS
FieldDescriptionDefaultFormat
maxNumberOfUses*The most number of usages this coupon is allowed. Only valid if this is a coupon - not valid for discount rules. '-1' refers to infinite number of uses.-1

Numeric

percentageDiscount*The discount in percentage this coupon or discount rule will apply. Leave blank  if flat discount is to be applied instead.
Numeric% (e.g. 10%)
flatDiscount*The flat discount amount this coupon or discount rule will apply. Leave blank if percentage discount is to be applied instead.
Numeric Currency (e.g. 100 USD for $100 USD worth of discount)
descriptionA description of the coupon or discount rule if any.
Text
priorityEach coupon or rule can only be applied once to any order. This field determines which coupon or rule will take priority - the higher the value, the higher the priority.0Numeric
name*Name of the coupon or discount rule.
Text
codeThe code of the coupon. Leave this blank for discount rules. For more information on the distinction between coupons and discount rules, refer to Discount Rules (Coupons / Rules).
Text
config*The configuration of the coupon or discount rule.
Refer to section configuration for this.

*Required Fields

Sample Files

This file imports an example coupon. View CSV section under Importing Entities for format conversion if needed.

  File Modified

Microsoft Excel Sheet sample_coupon_rule_import.csv

Jun 04, 2013 by jg

Configuration Field

Configuring a coupon or discount rule follows a syntax that might be a bit hard to follow. Template examples for the following most common use cases are shown below:

  1. Discounts for all items of product type
  2. Discounts for all items of class type
  3. Discounts for all items of class and product type
  4. Discounts for items of a specific product
  5. Discounts for items of a specific course
  6. Discounts for items of a specific course event
  7. Discounts for items of a specific product or specific course
  8. Discounts for items of a specific product or specific course event

1 - Discounts for all items of product type

{
  "@type" : "itemWithinQuantity",
  "maxQuantity" : 2147483647,
  "minQuantity" : 1,
  "restriction" : {
    "@type" : "and",
    "restrictions" : [ {
      "@type" : "anything"
    }, {
      "@type" : "createdDate",
      "endDate" : "2013-02-28 00:00:00"
    }, {
      "@type" : "or",
      "restrictions" : [ {
        "@type" : "itemTargetMatchesCondition",
        "field" : "keyword",
        "value" : "product"
      } ]
    } ]
  }
}


Set the expiration date on the field 'endDate'. Please note the date format used: 2013-02-28 00:00:00


2 - Discounts for all items of class type

{
  "@type" : "itemWithinQuantity",
  "maxQuantity" : 2147483647,
  "minQuantity" : 1,
  "restriction" : {
    "@type" : "and",
    "restrictions" : [ {
      "@type" : "anything"
    }, {
      "@type" : "createdDate",
      "endDate" : "2013-02-27 00:00:00"
    }, {
      "@type" : "or",
      "restrictions" : [ {
        "@type" : "itemTargetMatchesCondition",
        "field" : "keyword",
        "value" : "public_course_event"
      } ]
    } ]
  }
}


Set the expiration date on the field 'endDate'.  Please note the date format used: 2013-02-28 00:00:00


3 - Discounts for all items of class and product type

{
  "@type" : "itemWithinQuantity",
  "maxQuantity" : 2147483647,
  "minQuantity" : 1,
  "restriction" : {
    "@type" : "and",
    "restrictions" : [ {
      "@type" : "anything"
    }, {
      "@type" : "createdDate",
      "endDate" : "2013-02-27 00:00:00"
    }, {
      "@type" : "or",
      "restrictions" : [ {
        "@type" : "itemTargetMatchesCondition",
        "field" : "keyword",
        "value" : "product"
      }, {
        "@type" : "itemTargetMatchesCondition",
        "field" : "keyword",
        "value" : "public_course_event"
      } ]
    } ]
  }
}


Set the expiration date on the field 'endDate'.  Please note the date format used: 2013-02-28 00:00:00


4 - Discounts for items of a specific product

{
  "@type" : "itemWithinQuantity",
  "maxQuantity" : 2147483647,
  "minQuantity" : 1,
  "restriction" : {
    "@type" : "and",
    "restrictions" : [ {
      "@type" : "anything"
    }, {
      "@type" : "createdDate",
      "endDate" : "2013-02-27 00:00:00"
    }, {
      "@type" : "or",
      "restrictions" : [ {
        "@type" : "and",
        "restrictions" : [ {
          "@type" : "itemTargetMatchesCondition",
          "field" : "keyword",
          "value" : "product"
        }, {
          "@type" : "itemTargetMatchesCondition",
          "field" : "id",
          "value" : "85"
        } ]
      } ]
    } ]
  }
}


Set the expiration date on the field 'endDate', and the product id on the field 'value'.  Please note the date format used: 2013-02-28 00:00:00


5 - Discounts for items of a specific course

{
  "@type" : "itemWithinQuantity",
  "maxQuantity" : 2147483647,
  "minQuantity" : 1,
  "restriction" : {
    "@type" : "and",
    "restrictions" : [ {
      "@type" : "anything"
    }, {
      "@type" : "createdDate",
      "endDate" : "2013-02-27 00:00:00"
    }, {
      "@type" : "or",
      "restrictions" : [ {
        "@type" : "and",
        "restrictions" : [ {
          "@type" : "itemTargetMatchesCondition",
          "field" : "keyword",
          "value" : "public_course_event"
        }, {
          "@type" : "itemTargetMatchesCondition",
          "field" : "courseId",
          "value" : "69"
        } ]
      } ]
    } ]
  }
}


Set the expiration date on the field 'endDate', and the course id on the field 'value'.  Please note the date format used: 2013-02-28 00:00:00


6 - Discounts for items of a specific course event

{
  "@type" : "itemWithinQuantity",
  "maxQuantity" : 2147483647,
  "minQuantity" : 1,
  "restriction" : {
    "@type" : "and",
    "restrictions" : [ {
      "@type" : "anything"
    }, {
      "@type" : "createdDate",
      "endDate" : "2013-02-27 00:00:00"
    }, {
      "@type" : "or",
      "restrictions" : [ {
        "@type" : "and",
        "restrictions" : [ {
          "@type" : "itemTargetMatchesCondition",
          "field" : "keyword",
          "value" : "public_course_event"
        }, {
          "@type" : "itemTargetMatchesCondition",
          "field" : "id",
          "value" : "842"
        } ]
      } ]
    } ]
  }
}


Set the expiration date on the field 'endDate', and the course event id on the field 'value'.  Please note the date format used: 2013-02-28 00:00:00


7 - Discounts for items of a specific product or specific course

{
  "@type" : "itemWithinQuantity",
  "maxQuantity" : 2147483647,
  "minQuantity" : 1,
  "restriction" : {
    "@type" : "and",
    "restrictions" : [ {
      "@type" : "anything"
    }, {
      "@type" : "createdDate",
      "endDate" : "2013-02-27 00:00:00"
    }, {
      "@type" : "or",
      "restrictions" : [ {
        "@type" : "and",
        "restrictions" : [ {
          "@type" : "itemTargetMatchesCondition",
          "field" : "keyword",
          "value" : "product"
        }, {
          "@type" : "itemTargetMatchesCondition",
          "field" : "id",
          "value" : "86"
        } ]
      }, {
        "@type" : "and",
        "restrictions" : [ {
          "@type" : "itemTargetMatchesCondition",
          "field" : "keyword",
          "value" : "public_course_event"
        }, {
          "@type" : "itemTargetMatchesCondition",
          "field" : "courseId",
          "value" : "69"
        } ]
      } ]
    } ]
  }
}


Set the expiration date on the field 'endDate'. Also set the product id and course id on the appropriate 'value' fields.  Please note the date format used: 2013-02-28 00:00:00


8 - Discounts for items of a specific product or specific course event

{
  "@type" : "itemWithinQuantity",
  "maxQuantity" : 2147483647,
  "minQuantity" : 1,
  "restriction" : {
    "@type" : "and",
    "restrictions" : [ {
      "@type" : "anything"
    }, {
      "@type" : "createdDate",
      "endDate" : "2013-02-27 00:00:00"
    }, {
      "@type" : "or",
      "restrictions" : [ {
        "@type" : "and",
        "restrictions" : [ {
          "@type" : "itemTargetMatchesCondition",
          "field" : "keyword",
          "value" : "product"
        }, {
          "@type" : "itemTargetMatchesCondition",
          "field" : "id",
          "value" : "87"
        } ]
      }, {
        "@type" : "and",
        "restrictions" : [ {
          "@type" : "itemTargetMatchesCondition",
          "field" : "keyword",
          "value" : "public_course_event"
        }, {
          "@type" : "itemTargetMatchesCondition",
          "field" : "id",
          "value" : "849"
        } ]
      } ]
    } ]
  }
}

Set the expiration date on the field 'endDate'. Also set the product id and course event id on the appropriate 'value' fields.  Please note the date format used: 2013-02-28 00:00:00