Out of box, commerce server provides six types of discounts. This will satisfy majority of business requirements to provide flexible discounts to their customers but in today’s dynamic world these discounts are not enough. What if the business wants to give shipping discounts based on shipping method selected. Many developers feels that this requirement cannot be achievable but here are the two workarounds to achieve this requirement.

  1. Using profile Targeting
  2. Using Custom Pipeline.

Using Profile Targeting:

This approach is similar to current approach but small changes.

  • Extend profile system to capture order shipping method. The value will be set/updated during checkout process.
  • Create different order level discounts for every shipping method. I.e., in the target expression we will target it on shipping method. Consider following table.
Shipping Method Minimum Order Amount Priority Amount Off
ByGround

20

4

10%

ByGround

100

3

15%

ByGround

200

2

50%

ByGround

300

1

100%

Here we will create four discounts and target to “By Ground” shipping method.

 

 

In this case commerce server decides which discount to apply to the basket. The administrator can set the priority to discounts so that when two are more discounts are eligible CS can apply top priority discount.

Advantages:

  • Easy to implement.
  • Business users can create new discounts using marketing manager.
  • Can do user targeting (applied only to users of California).

Disadvantages:

  • Mistakes in priorities may leads to problems.
  • If there are more rules, its end up creating multiple discounts (leads to confusion).

Using Custom Pipeline

In this approach, we are implementing shipping discounts based on business rules. We will create a small utility by which the users can capture all rules data. For example,

Shipping Method Minimum Order Amount Priority Amount Off
ByGround

20

4

10%

ByGround

100

3

15%

ByGround

200

2

50%

ByGround

300

1

100%

The application allows users to extract this data into XML

<Discounts>
     <Discount>
          <ShippingMethod>By Ground </ShippingMethod>
          <MinimumOrder> 20 </MinimumOrder>
          <Priority>4</ Priority>
          <AmountOff>10</ AmountOff>
     </Discount>
     <Discount>
          <ShippingMethod>By Ground </ShippingMethod>
          <MinimumOrder> 50 </MinimumOrder>
          <Priority>3</ Priority>
          <AmountOff>15</ AmountOff>
     </Discount>
     <Discount>
          <ShippingMethod>By Ground </ShippingMethod>
          <MinimumOrder> 200 </MinimumOrder>
          <Priority>50</ Priority>
          <AmountOff>50</ AmountOff>
     </Discount>
     <Discount>
          <ShippingMethod>By Ground </ShippingMethod>
          <MinimumOrder> 300 </MinimumOrder>
          <Priority>1</ Priority>
          <AmountOff>100</ AmountOff>
     </Discount>
</Discounts>

We will create a custom pipeline component which will take this value as input. This input can be provided by administrator through pipeline component editor as shown below.

 

This component will append business rule data to the dictionary so that the data can be available to rest of the components.

“Commerce.ShippingMethodRouter” will load corresponding shipping calculator based on shipping method. In current scenario, it will call shipping calculator component which interacts with third party web services to calculate shipping cost. Since we have business rules available to shipping cost calculator, it’s easy to get what discount we can provide. We will deduct cost from the actual shipping cost before assigning it back to dictionary.

Note: We can also implement this by using BizTalk rule engine instead of XML.

Advantages:

  • Can implement many rules?
  • No need to create different promotions.

Disadvantages:

  • Every time the business user has to reach to admin to amend latest changes.
  • We cannot implement user targeting (this discount is applicable to only California shipments)

Related Articles


If you like this post, please click on our sponsor advertisement.


2 Responses to “Discounts on Shipping Methods”

  • Naga:

    Hello,
    What would be the “Field” value in the expression clause while creating expression types? I am trying to set it to OrderForm["ShippingMethod"], but, Shipping Method does not appear in the list of available field names. All the filed names are associated with a profile.

    Thanks,
    Naga

  • Naga,
    I didn’t understand your question. Shipping class is part of OrderForm and ShippingMethod is part of Shipping class. If this doesn’t help you, please eloborate your problem again.

Leave a Reply

Follow me on Google+
Add to circles

In 0 people's circles

Sign up for Newsletter