Example: Adjustment XML fragments

Reviewing the XML representation of some common adjustments in the runtime promotion XML for a promotion type can help you understand how to customize an adjustment.

Bonus point adjustment

<!-- This adjustment cannot be handled by the order subsystem. -->
<Adjustment impl="com.ibm.commerce.marketing.promotion.reward.CustomNumericValueAdjustment">
   <CustomNumericValue>12</CustomNumericValue>

   <!-- Possible values are 
      wholeOrder: This adjustment is applied to the entire order as a whole.
      IndividualAffectedItem: This adjustment is applied to each and every 
          one of the affected order items.
      AllAfftectedItems: This adjustment is applied to all affected order 
          items as a whole.
             
      This attribute is common to all Adjustments.
        -->
   <AdjustmentType>wholeOrder</AdjustmentType>
</Adjustment>

Simple fixed amount off adjustment

<Adjustment impl="com.ibm.commerce.marketing.promotion.reward.FixedAmountOffAdjustment">
   <AmountOff>15</AmountOff>
   <Currency>USD</Currency>
   <AdjustmentType>wholeOrder</AdjustmentType>
</Adjustment>

Complex fixed amount off adjustment

<!-- Applies to a set of order items, based on the quantity in the set, this assigns 
     different discount amounts to the items.
     -->
<Adjustment impl="com.ibm.commerce.marketing.promotion.reward.FixedAmountOffVolumeAdjustment">
   <AdjustmentType>IndividualAffectedItems</AdjustmentType>
   <Range>
      <AmountOff>15</AmountOff>
      <Currency>CAD</Currency>
      <LowerBound>1</LowerBound>
      <UpperBound>5</UpperBound>
      <LowerBoundIncluded>true</LowerBoundIncluded>
      <UpperBoundIncluded>true</UpperBoundIncluded>
   </Range>
   <Range>
      <AmountOff>25</AmountOff>
      <Currency>CAD</Currency>
      <LowerBound>6</LowerBound>
      <!-- -1 indicates unlimited -->
      <UpperBound>-1</UpperBound>
      <LowerBoundIncluded>true</LowerBoundIncluded>
      <UpperBoundIncluded>false</UpperBoundIncluded>
   </Range>
</Adjustment>

Fixed amount off shipping adjustment

<Adjustment impl="com.ibm.commerce.marketing.promotion.reward.FixedAmountOffShippingAdjustment">
   <AmountOff>15</AmountOff>
   <Currency>CAD</Currency>
   <AdjustmentType>wholeOrder</AdjustmentType>
</Adjustment>

Fixed cost adjustment

<Adjustment impl="com.ibm.commerce.marketing.promotion.reward.FixedCostAdjustment">
   <FixedCost>45</FixedCost>
   <Currency>CAD</Currency>
   <AdjustmentType>wholeOrder</AdjustmentType>
</Adjustment>

Fixed cost shipping adjustment

<Adjustment impl="com.ibm.commerce.marketing.promotion.reward.FixedCostShippingAdjustment">
   <FixedCost>15</FixedCost>
   <Currency>CAD</Currency>
   <AdjustmentType>wholeOrder</AdjustmentType>
</Adjustment>

Free gift with purchase adjustment

<Adjustment impl="com.ibm.commerce.marketing.promotion.reward.FreePurchasableGiftAdjustment">
    <GiftItem>
        <CatalogEntryKey>
            <SKU>SKU-20101099</SKU>
            <DN>o=Root Organization</DN>
        </CatalogEntryKey>
    </GiftItem>
    <Quantity>1</Quantity>
    <!-- Possible values are:
        0: As needed: If there are any items in the shop cart that satisfy free 
                      gift description, that item will be marked down by 100%. 
                      If there is not or there is not enough, free gifts will be 
                      added.

        1: Always add: Regardless of what is in the shopcart add the free gifts.
        2: Never add: Never add free gift, if the shoppers are to get the free 
                      gifts, they have to put the gifts into the shop cart by 
                      themselves.
         -->
    <AddStrategy>0</AddStrategy>
    <AdjustmentType>wholeOrder</AdjustmentType>
</Adjustment>

Percent off adjustment

<Adjustment impl="com.ibm.commerce.marketing.promotion.reward.PercentOffAdjustment">
   <Percentage>15</Percentage>
   <AdjustmentType>wholeOrder</AdjustmentType>
</Adjustment>

Percent off shipping adjustment

<Adjustment impl="com.ibm.commerce.marketing.promotion.reward.PercentOffShippingAdjustment">
    <PercentOff>10</PercentOff>
    <AdjustmentType>wholeOrder</AdjustmentType>
</Adjustment>

Promotion reward issues coupon adjustment

<Adjustment impl="com.ibm.commerce.marketing.promotion.reward.VoucherAdjustment">
    <PromotionKey>
        <PromotionName>20% Off Any Purchase</PromotionName>
        <StoreKey>
            <DN>Root Organization</DN>
            <Identifier>Store 201</Identifier>
        </StoreKey>
        <Version>2</Version>
        <Revision>1</Revision>
    </PromotionKey>
    <AdjustmentType>wholeOrder</AdjustmentType>
</Adjustment>

Fixed amount off on standard offer price, contract price, or discounted price

<Adjustment impl= "com.ibm.commerce.marketing.promotion.reward.FixedAmountOffPriceAdjustment">

    <!-- Possible values are:
        -1: Standard offer price
        -2: Contract price 
        -3: Discounted price
         -->
    <PriceAdjustmentBase>-1</PriceAdjustmentBase>
    <AmountOff>15</AmountOff>
    <Currency>CAD</Currency>

    <!-- For B2B price adjustments this field is always IndividualAfftectedItems -->
    <AdjustmentType>IndividualAffectedItems</AdjustmentType>
</Adjustment>

Percent off standard offer price, contract price, or discounted price

<Adjustment impl="com.ibm.commerce.marketing.promotion.reward.PercentOffPriceAdjustment">

   <!-- Possible values are:
       -1: Standard offer price
       -2: Contract price
       -3: Discounted price 
        -->
    <PriceAdjustmentBase>-1</PriceAdjustmentBase>
    <Percentage>15</Percentage>
    <AdjustmentType>IndividualAffectedItems</AdjustmentType>
</Adjustment>