Fixed amount for Order discount

   —   

This article talks about setting up an Order discount which will give a fixed amount discount on the order.

Current situation

Since Kentico 11 has been released, fixed amount Order discounts are no longer available. Their place has been taken by Gift cards which are supposed to serve as a substitute. However, they sometimes do not fit the scenario fully and this is why I’m going to show you how to bring back the fixed amount Order discount. 

Solution

First, you need to display the “fixed amount” option for the Discount field. 
1.    Navigate to the Modules application 
2.    Edit the E-commerce module 
3.    Switch to the Classes tab and edit the Discount class  
4.    Switch to the Alternative forms tab and edit the Order discount form  
5.    Switch to the Fields tab and select the DiscountIsFlat field 
6.    Set "Display field in the editing form" to true 
7.    Click Save


Now the DiscountValue field’s validation rules needs to be changed. 
1.    Select the DiscountValue field and do the below changes
     1.    Delete the existing Validation rule
     2.    Create two new rules as per below screenshots
Rule 1.

Rule 2.

     3.    Insert the dynamic expression below into the Content after field

<span class="form-control-text">{% DiscountIsFlat.Value ? HTMLEncode(GetMainSiteCurrency((DiscountSiteID == 0)? CMSContext.CurrentSiteID : DiscountSiteID).CurrencyCode) :"%"%}</span> 


Now that you have followed all the steps above, you are able to select Fixed amount in your Order discount. 
Please note that this applies to Kentico 11. 

Share this article on   LinkedIn Google+