Is this really the version you are looking for? Kentico Xperience 11 Documentation is no longer updated. Use the switcher in the header to choose your product version.
Discount rules are user-friendly representations of macro conditions used to limit catalog discounts, order discounts, free shipping offers, and gift cards. If the system evaluates the condition as true, the respective discount or offer is valid and the system applies it (unless configured otherwise). This page describes how to extend the default conditions. When writing rule conditions, you can either use the available macro syntax or include custom macro methods.
There are two types of the discount rules:
The main difference between the rule types is the data available for the conditions.
Using context objects not related to the product or shopping cart calculation data
We strongly recommend NOT using time-related objects such as CurrentUser or CurrentPath in your custom discount rules.
These objects may no longer be relevant in the session context at the time of evaluation, causing unexpected application of discounts or offers that use the rule in their condition.
Currency of monetary values in order rules
For Order rules, all monetary macro properties (GrandTotal, OrderDiscount, Tax, etc.) have values in the currency that the customer selected for the evaluated shopping cart or order.
If you have a store with multiple currencies and are creating an order rule that evaluates a monetary value, you need to adjust the condition code according to the currency (for example using the Currency.CurrencyCode property).
You can add new discount rules using macro rules directly from the Kentico administration interface:
Open the Store configurationapplication if you want to create a discount rule for the current site. Open the Multistore configuration application if you run more sites on the same Kentico instance and want to add the rule for all sites.
If you are not sure what to choose, see Choosing site or global e-commerce configuration. If you are not sure about specifics of configuring in these applications, see Configuring e-commerce settings for a specific site or globally.
Select the Discount rules -> Catalog rules tab to manage catalog discount rules. Select the Discount rules -> Order rules tab to manage order discount rules.
Click New catalog rulewhen on the Catalog rulestab. Click New order rule when on the Order rules tab.
Fill in the discount rule's properties:
General | |
|---|---|
Display name | The name of the discount rule displayed in the administration interface. For example, when editing a discount. |
Name | The unique identifier of the discount rule object used in the code. Unless there is a reason to set a particular value, you can leave the default (automatic) option, and the system generates an appropriate code name automatically. |
Description | To make the discount rule easier to use and maintain, you can add an explanation about the scenarios for which the rule is intended, etc. The description does not have any functionality; it is just for your better orientation. |
Enabled | Indicates if the discount rule is available to use when editing a discount. If the check box is cleared, the system does not display the rule. |
Rule data | |
User text | The text displayed in the discount rule designer window. |
The discount rule is now configured and saved. Store managers can use the rule for their discounts and special offers.
Discount rules using a custom macro method (more advanced)
For more advanced rules and scenarios that cannot be achieved using the default Kentico macros, you can develop a custom macro method and then call that method in your discount rules.
To learn how to create a discount rule that uses a custom macro method, see: Adding a discount rule with a custom method
To add parameters to the text, type their name of a specific parameter enclosed in curly brackets. For example: {days}
Condition | The macro condition represented by the rule. Define the condition through standard macro code. The field provides autocomplete support. Available data:
|
Required data | Leave this property empty. |
Requires context | Leave this property empty. |
More detailed information
To learn more about entering the rule data, see Creating macro rules.
If your discount rule contains any parameters, switch to the Parameters tab.