Discounts on Shipping Methods
ravikanth | October 25, 2008Out 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.
- Using profile Targeting
- 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)