Dev GuideAPI Reference
Dev GuideAPI ReferenceUser GuideGitHubNuGetDev CommunityDoc feedbackLog In
GitHubNuGetDev CommunityDoc feedback

In this example, the website needs to provide a discount to customers who have the default payment method set to ACH or Credit Card. This requires building a custom derived criteriatype class that will serve as the rule type option for promotions.

This example will use a LookupObject to populate the simple value for the Terms Code when configuring the Rule Type Option in the Admin Console.


  • The payment methods of ACH and CC must be configured in the Admin console

  • The customers must have the Default Payment Method configured on their account

  • Shipping carriers and services must be configured in order to complete the checkout process

  1. In the <<product-name>> Web project in Visual Studio create a new folder called Extensions.

  2. Add a new Class called CriteriaTypeOrderTermsCode

  3. Derive from the base class CriteriaTypeBase and decorate the class with the Dependency attribute with a name of OrderTermsCode.

  4. Override the **LookupObject** and **CriteriaObject** properties. These are two important overrides to note as the PaymentMethod will populate the drop down in the Admin Console and the CustomerOrder will be the object this rule operates on.

  5. Override the remaining abstract properties as follows:

  6. The Terms Code will validate whether the customer has a particular Terms Code or not. Override and add the equals and not equals rule type comparison operators to the **ValidRuleClauseComparisonOperators** collection.

  7. Next define the parameters that can be configured using the Admin Console. In this example it will use a "Select Based On" parameter to choose between the equals or not equals comparison operators. It will also use a **Terms Code** value that will be selected from a drop down of all the valid options. This is where the **LookupObject** is leveraged. Override the **ParameterDescriptions** property and add the two dictionary values.

  8. Override the **Validate** method which will handle the logic of the configuration defined and selected. The following will validate the argument is a **CustomerOrder**, as configured in the **CriteriaObject** property, and return true or false based on the value configured to the customer.

  9. Build the solution and log into the Admin Console.

  10. Go to **Administration** \> **System** \> **Rule Types**, and edit the **Promotion Rule Type**.

  11. Go to the **Rule Options** finger tab and click the **Add Rule Type** button.

  12. Configure the new Rule Type Option as follows:

    • **Description** – Terms Code

    • **Criteria Type** – Order Terms Code

    • **Criteria Object** – CustomerOrder

  13. Save the changes.

  14. Go to **Marketing** \> **Promotions** and create two new promotions. Create one promotion with the Terms Code rule using the ACH terms code value and equals operator. Create the other promotion rule with the Terms Code rule using CC as the terms code value and equals operator. For both, the result should be Percentage off the order. Experiment with these values where appropriate. For example, set the ACH terms code result to 25% off the order and set the CC terms code result to 5% off the order.

  15. Save the changes.

  16. Go to **Websites** and edit the existing <<product-name>> website.

  17. Go to the **Promotions** finger tab and assign the two Promotions to the website.

  18. Finally, go to the **Settings** finger tab and set the **AllowCreditcardPaymentMethod** as false.

  19. Save the changes and go to the website site.

  20. Complete the checkout process signed in as a customer with ACH and note the discount applied on the order.