Sample promotions

This section includes sample promotions you can create with the Admin API.

This section applies to both OSF and Storefront Classic. This section applies to Open Storefront Framework (OSF) and Storefront Classic.

The following promotions include sample request bodies for the POST /ccadmin/v1/promotions endpoint.

You can find more sample promotions in Custom Promotions API How-To with Examples on Oracle Cloud Customer Connect.

Get Order Discount

This promotion automatically discounts an entire order with no spend requirements.

The following example creates a promotion that discounts an order by 10%.

{
  "displayName":"Get 10% off your order",
  "description":"A get order discount promotion",
  "priceListGroups":["defaultPriceGroup"],
  "enabled":true,
  "priority":"1",
  "startDate":"2016-03-10T00:00:00.000-05:00",
  "endDate":"2116-03-30T00:00:00.000-05:00",
  "templatePath": "order",
  "templateName": "rawPmdlTemplate",
  "templateValues":{"pmdl": {"xml": "<pricing-model><qualifier/><offer>
    <discount-structure calculator-type="standard" discount-type="percentOff"
    adjuster="10"/></offer></pricing-model>"}
}
}

Spend Y in X Get Order Discount

This promotion discounts an entire order when the shopper spends the specified amount in the specified collections.

The following example creates a promotion that discounts an order by 10% when the shopper spends $20 in the Summer Favorites collection, whose ID is cat60036.

{
  "displayName":"Spend $20 in Summer Favorites Get Order Discount",
  "description":"A sample spend y in x get order discount promotion",
  "priceListGroups":["defaultPriceGroup"],
  "enabled":true,
  "priority":"1",
  "startDate":"2016-03-10T00:00:00.000-05:00",
  "endDate":"2116-03-30T00:00:00.000-05:00",
  "templatePath": "order",
  "templateName": "rawPmdlTemplate",
  "templateValues":{"pmdl": {"xml": "<pricing-model><qualifier>
    <quantifier name="at-least" number="20"><collection-name>items</collection-
    name><element-name>item</element-name><aggregator name="spendAmount"
    operation="total"/><comparator name="includes-any">
    <value>item.auxiliaryData.productRef.ancestorCategoryIds</value>
    <constant><data-type>java.util.Set</data-type><string-value>cat60036</string-
    value></constant></comparator></quantifier></qualifier><offer>
    <discount-structure calculator-type="standard" discount-type="percentOff"
    adjuster="10"></discount-structure></offer></pricing-model>"}
}
}

Spend Y in X Get Item Discount

This promotion discounts one or more items when a shopper spends the specified amount in the specified collections. Unlike the Spend Y Get Order Discount promotion, which looks only at the total amount spent on the order to determine whether the customer qualifies for the promotion, this promotion examines the individual items in the shopping cart.

The following example creates a promotion that discounts the product Beach Umbrella by 50% when the shopper spends $10 in the Summer Favorites collection, whose ID is cat60036.

{
  "displayName":"Spend $10 in Summer Favorites, get 50% off a beach umbrella",
  "description":"A sample spend y in x get item discount promotion",
  "priceListGroups":["defaultPriceGroup"],
  "enabled":true,
  "priority":"1",
  "startDate":"2016-03-10T00:00:00.000-05:00",
  "endDate":"2116-03-30T00:00:00.000-05:00",
  "templatePath": "item",
  "templateName": "rawPmdlTemplate",
  "templateValues":{"pmdl": { "xml": {"<pricing-model><qualifier><quantifier
    name="at-least" number="10"><collection-name>items</collection-name><element-
    name>item</element-name><aggregator name="spendAmount"
    operation="total"/><comparator name="includes-any">
    <value>item.auxiliaryData.productRef.ancestorCategoryIds</value>
    <constant><data-type>java.util.Set</data-type><string-
    value>cat60036</string-value></constant></comparator>
    </quantifier></qualifier><offer><discount-structure
    calculator-type="standard" discount-type="percentOff"
    adjuster="50"><target><iterator name="up-to-and-including" number="-1"
    sort-by="priceInfo.listPrice" sort-order="ascending">
    <collection-name>items</collection-name><element-name>item</element-name>
    <aggregator name="quantity" operation="total"/>
    <comparator name="includes-any">
    <value>item.auxiliaryData.productRef.ancestorCategoryIds</value>
    <constant><data-type>java.util.Set</data-type>
    <string-value>cat60036</string-value></constant></comparator>
    </iterator></target></discount-structure></offer></pricing-model>"}
}
}

Spend Y in X Get Shipping Discount

This promotion offers free shipping when the shopper purchases items from a specified collection.

The following example creates a promotion that offers free shipping when a shopper buys anything from the Summer Favorites collection, whose ID is cat60036.

{
  "displayName":"Spend $10 in Summer Favorites, Get Free Shipping",
  "description":A sample spend y in x get shipping discount promotion,
  "priceListGroups":["defaultPriceGroup"],
  "enabled":true,
  "priority":"1",
  "startDate":"2016-03-10T00:00:00.000-05:00",
  "endDate":"2016-03-30T00:00:00.000-05:00",
  "templatePath": "shipping",
  "templateName": "rawPmdlTemplate",
  "templateValues":{"pmdl": {"xml": "<pricing-model><qualifier><quantifier
    name=\"at-least\" number=\"10\"><collection-name>items</collection-name>
    <element-name>item</element-name><aggregator name=\"spendAmount\"
    operation=\"total\"/><comparator name=\"includes-any\">
    <value>item.auxiliaryData.productRef.ancestorCategoryIds</value>
    <constant><data-type>java.util.Set</data-type>
    <string-value>cat60036</string-value></constant></comparator>
    </quantifier></qualifier> <offer><discount-structure calculator-type=\"standard\"
    discount-type=\"fixedPrice\" adjuster=\"0\"></discount-structure>
    </offer></pricing-model>"}
}
}

Apply shipping discounts to individual shipping groups

Shipping discount promotions you create from templates in the administration interface apply to a shopper's entire order. However, you can use the Admin API to create promotions that discount shipping for individual, qualifying shipping groups. You can create promotions that discount shipping when a shipping group reaches a value threshold ("Spend $100, Get Free Ground Shipping") or when it contains specific items ("All Outerwear Ships Free").

The following sample request body creates a promotion that offers free ground shipping for a shipping group when it contains anything from the Summer Favorites collection, whose ID is cat60036.

{
  "displayName":"Free Shipping on All Your Summer Favorites",
  "description":"A sample shipping discount promotion for individual shipping groups",
  "priceListGroups":["defaultPriceGroup"],
  "enabled":true,
  "priority":"1",
  "startDate":"2018-03-10T00:00:00.000-05:00",
  "endDate":"2018-03-30T00:00:00.000-05:00",
  "shippingMethods":"US48Ground",
  "templatePath": "shipping",
  "templateName": "rawPmdlTemplate",
  "templateValues":{"pmdl": {"xml": 
    "<pricing-model>
      <qualifier>
        <quantifier name=\"at-least\" number=\"1\">
          <collection-name>shippingGroup.commerceItemRelationships</collection-name>
          <element-name>item</element-name>
          <aggregator name=\"spendAmount\" operation=\"total\"/>
          <comparator name=\"includes-any\">
            <value>item.auxiliaryData.productRef.ancestorCategoryIds</value>
            <constant>
              <data-type>java.util.Set</data-type>
              <string-value>cat60036</string-value>
            </constant>
          </comparator>
        </quantifier>
      </qualifier>
      <offer>
        <discount-structure calculator-type=\"standard\" discount-type=\"fixedPrice\" adjuster=\"0.0\">
        </discount-structure>
      </offer>
    </pricing-model>"}}
}

The following sample request body creates a promotion that offers free two-day shipping when a shipping group contains $100 in merchandise.

{
  "displayName":"Spend $100, Get Free 2 Day Shipping",
  "description":"A sample shipping discount promotion for individual shipping groups",
  "priceListGroups":["defaultPriceGroup"],
  "enabled":true,
  "priority":"1",
  "startDate":"2018-03-10T00:00:00.000-05:00",
  "endDate":"2018-03-30T00:00:00.000-05:00",
  "shippingMethods":"US48TwoDay",
  "templatePath": "shipping",
  "templateName": "rawPmdlTemplate",
  "templateValues":{"pmdl": {"xml": 
    "<pricing-model>
      <qualifier>
        <greater-than>
          <value>shippingGroup.priceInfo.itemSubtotal</value>
          <constant>
            <data-type>java.lang.Double</data-type>
            <string-value>100.0</string-value>
          </constant>
        </greater-than>
      </qualifier>
      <offer>
        <discount-structure calculator-type=\"standard\" discount-type=\"fixedPrice\" adjuster=\"0.0\">
        </discount-structure>
      </offer>
    </pricing-model>"}}
}

The following examples show how you could extend the PDML to make customized promotions

Get 15% off order when you buy both product X and Y

This sample request body creates a promotion that takes 15% off of an order when the customer purchase both of the specified products:
{
  "displayName": "Spend $100 in Category X and must buy both product Y and Z from category X get 15% Off Order",
  "description": "A sample 15% off order promotion",
  "enabled":true,
  "priority":"1",
  "templatePath": "order",
  "templateName": "rawPmdlTemplate",
  "templateValues": {
    "pmdl": {
      "xml": "<pricing-model><qualifier><anded-union><iterator name=\"next\" number=\"1\" 
         sort-by=\"priceInfo.listPrice\" sort-order=\"descending\"><collection-name>items</collection-name>
         <element-name>item</element-name><aggregator name=\"quantity\" operation=\"total\"/><equals>
         <value>item.auxiliaryData.productId</value><constant><data-type>java.lang.String</data-type>
         <string-value>Product_36Exy</string-value></constant></equals></iterator>
         <iterator name=\"next\" number=\"1\" sort-by=\"priceInfo.listPrice\" sort-order=\"descending\">
         <collection-name>items</collection-name><element-name>item</element-name>
         <aggregator name=\"quantity\" operation=\"total\"/><equals>
         <value>item.auxiliaryData.productId</value><constant><data-type>java.lang.String</data-type>
         <string-value>Product_27Fxyzi</string-value></constant></equals></iterator>
         <iterator name=\"next\" number=\"100\" sort-by=\"priceInfo.listPrice\" sort-order=\"ascending\">
         <collection-name>items</collection-name><element-name>item</element-name>
         <aggregator name=\"spendAmount\" operation=\"total\" /><includes>
         <value>item.auxiliaryData.productRef.ancestorCategoryIds</value><constant>
         <data-type>java.lang.String</data-type><string-value>Category_14Bxi</string-value></constant>
         </includes></iterator></anded-union></qualifier><offer>
         <discount-structure calculator-type=\"standard\" discount-type=\"percentOff\" adjuster=\"15\"/>
         </offer></pricing-model>"
    }
  }
}

Spend $100 in Category X get 15% off order

This sample request body creates a promotion where, once the shopper has spent $100 in Category X and have bought both product Y and Z from Category X, they receive 15% off their order:
{
  "displayName": "Buy both product Y and Z from category X. Get 15% Off Order",
  "description": "A sample promotion for 15% off an order",
  "enabled":true,
  "priority":"1",
  "templatePath": "order",
  "templateName": "rawPmdlTemplate",
  "templateValues": {
    "pmdl": {
      "xml": "<pricing-model><qualifier><anded-union><iterator name=\"next\" number=\"1\" 
         sort-by=\"priceInfo.listPrice\" sort-order=\"descending\"><collection-name>items</collection-name>
         <element-name>item</element-name><aggregator name=\"quantity\" operation=\"total\"/><equals>
         <value>item.auxiliaryData.productId</value><constant><data-type>java.lang.String</data-type>
         <string-value>Product_36Exy</string-value></constant></equals>
         </iterator><iterator name=\"next\" number=\"1\" sort-by=\"priceInfo.listPrice\" 
         sort-order=\"descending\"><collection-name>items</collection-name><element-name>item</element-name>
         <aggregator name=\"quantity\" operation=\"total\"/><equals>
         <value>item.auxiliaryData.productId</value><constant><data-type>java.lang.String</data-type>
         <string-value>Product_27Fxyzi</string-value></constant></equals></iterator></anded-union>
         </qualifier><offer><discount-structure calculator-type=\"standard\" discount-type=\"percentOff\"
         adjuster=\"15\"/></offer></pricing-model>"
    }
  }
}

Spend $200 in Category X or Category XX and get 15% off order

This sample request body creates a promotion where the promotion is extended after the shopper has spent $200 in either Category X or Y and has purchased both products Y and Z from Category X.
{
  "displayName": "Spend $200 in Category X or Category XX and must buy both product Y and Z from category X. Get 15% Off Order",
  "description": "An example promotion for 15% off order",
  "enabled":true,
  "priority":"1",
  "templatePath": "order",
  "templateName": "rawPmdlTemplate",
  "templateValues": {
    "pmdl": {
      "xml": "<pricing-model><qualifier><and><at-least number=\"200\"><collection-name>items</collection-name>
         <element-name>item</element-name><aggregator name=\"spendAmount\" operation=\"total\" />
         <comparator name=\"includes-any\"><value>item.auxiliaryData.productRef.ancestorCategoryIds</value>
         <constant><data-type>java.util.Collection</data-type><string-value>Category_14Bxi</string-value>
         <string-value>Category_35Exy</string-value></constant></comparator></at-least><at-least number=\"1\">
         <collection-name>items</collection-name><element-name>item</element-name><aggregator name=\"quantity\"
         operation=\"total\"/><equals><value>item.auxiliaryData.productId</value><constant>
         <data-type>java.lang.String</data-type><string-value>Product_36Exy</string-value></constant></equals>
         </at-least><at-least number=\"1\"><collection-name>items</collection-name>
         <element-name>item</element-name><aggregator name=\"quantity\" operation=\"total\"/><equals>
         <value>item.auxiliaryData.productId</value><constant><data-type>java.lang.String</data-type>
         <string-value>Product_27Fxyzi</string-value></constant></equals></at-least></and></qualifier><offer>
         <discount-structure calculator-type=\"standard\" discount-type=\"percentOff\" adjuster=\"15\"/>
         </offer></pricing-model>"
    }
  }
}

Group item discount

The following sample request body allows you to offer a group of products at a discount or fixed price. This type of promotion applies only to item discount promotions, where the customer receives a discount on an individual item or multiple items. This example extends 30% off of the item when you buy something from Category_14Nxi and Category_35Exy:
{
  "displayName": "Group Discount - Buy something from Category_14Bxi and Category_35Exy and get 30% off",
  "description": "A sample promotion for 30% off for group discount",
  "enabled": true,
  "priority": "1",
  "templatePath": "item",
  "templateName": "rawPmdlTemplate",
  "templateValues": {
    "pmdl": {
      "xml": "<pricing-model><qualifier /><offer><discount-structure calculator-type=\"group\"
         discount-type=\"percentOff\" adjuster=\"30\"><target><group-iterator name=\"every-group\">
         <anded-union><iterator name=\"next\" number=\"1\" sort-by=\"priceInfo.listPrice\"
         sort-order=\"ascending\"><collection-name>items</collection-name><element-name>item</element-name>
         <aggregator name=\"quantity\" operation=\"total\"/><comparator name=\"includes-any\">
         <value>item.auxiliaryData.productRef.ancestorCategoryIds</value><constant>
         <data-type>java.util.Set</data-type><string-value>Category_14Bxi</string-value></constant>
         </comparator></iterator><iterator name=\"next\" number=\"1\" sort-by=\"priceInfo.listPrice\"
         sort-order=\"descending\"><collection-name>items</collection-name><element-name>item</element-name>
         <aggregator name=\"quantity\" operation=\"total\"/><comparator name=\"includes-any\">
         <value>item.auxiliaryData.productRef.ancestorCategoryIds</value><constant>
         <data-type>java.util.Set</data-type><string-value>Category_35Exy</string-value></constant>
         </comparator></iterator></anded-union></group-iterator></target></discount-structure></offer>
         </pricing-model>"
    }
  }
}

BOGO Gift With Purchase

The following sample request body allows you to create a promotion that combines both BOGO and Gift With Purchase promotions, which gives a shopper who buys a camera a free gift card SKU. This promotion adds a specific SKU as the gift, and automatically adds the SKU to the cart. This promotion loops, so every time the shopper meets the conditions, they receive the gift. Note that BOGO promotions loop by default, but Gift With Purchase promotions do not.:
{
  "displayName": "BOGO GWP",
  "description": "1 gift for 1",
  "priceListGroups": [
    "defaultPriceGroup"
  ],
  "enabled": true,
  "priority": "1",
  "templatePath": "item",
  "templateName": "rawPmdlTemplate",
  "templateValues": {
    "pmdl": {
      "xml": "<pricing-model><qualifier><iterator name=\"next\" number=\"1\" sort-by=\"priceInfo.listPrice\" 
         sort-order=\"ascending\"><collection-name>items</collection-name><element-name>item</element-name>
         <aggregator name=\"quantity\" operation=\"total\"/><comparator name=\"includes-any\">
         <value>item.auxiliaryData.productRef.ancestorCategoryIds</value><constant>
         <data-type>java.util.Set</data-type><string-value>cameracat</string-value></constant></comparator>
         </iterator></qualifier><offer><discount-structure calculator-type=\"gwp\" discount-type=\"fixedPrice\"
         adjuster=\"0\" process-zero-targets=\"true\"><discount-detail name=\"gift\">
         <attribute name=\"quantity\" value=\"1\"/><attribute name=\"autoRemove\" value=\"true\"/>
         <attribute name=\"giftDetail\" value=\"giftCardsku_1\"/><attribute name=\"giftType\" value=\"sku\"/>
         </discount-detail> <target><iterator name=\"up-to-and-including\" number=\"1\"
         sort-by=\"priceInfo.listPrice\" sort-order=\"ascending\"><collection-name>items</collection-name>
         <element-name>item</element-name><element-quantity-property>quantity</element-quantity-property>
         <comparator name=\"equals\"><value>item.auxiliaryData.catalogRef.id</value><constant>
         <data-type>java.lang.String</data-type><string-value>giftCardsku_1</string-value></constant>
         </comparator></iterator></target></discount-structure></offer></pricing-model>"
    }
  }
}

Pick two items from a predefined selection for a fixed price

The following example displays a promotion that is triggered when two items are selected. Note that this promotion iterate, allowing the shopper to by 2 of the items for $15, 4 of the items for $30, etc.:
{
  "displayName": "$15 for every 2 soaps",
  "description": "$15 for every 2 soaps",
  "priceListGroups": [
    "defaultPriceGroup"
  ],
  "enabled": true,
  "priority": "1",
  "templatePath": "item",
  "templateName": "rawPmdlTemplate",
  "templateValues": {
    "pmdl": {
      "xml": "<pricing-model><qualifier/><offer><discount-structure adjuster=\"7.5\" 
      calculator-type=\"standard\" discount-type=\"fixedPrice\"><target><every-group><union>
      <iterator name=\"next\" number=\"2\" sort-by=\"priceInfo.listPrice\" sort-order=\"ascending\">
      <collection-name>items</collection-name><element-name>item</element-name>
      <aggregator name=\"quantity\" operation=\"total\"/><comparator name=\"includes-any\">
      <value>item.auxiliaryData.productRef.ancestorCategoryIds</value><constant><data-type>java.util.Set</data-type>
      <string-value>SOAPS</string-value></constant></comparator></iterator></union></every-group></target>
      </discount-structure></offer></pricing-model>"
    }
  }
}