Create discount criteria

To create discount criteria, you must perform the following:

  1. Get the orders manager.
    Get an instance of the OrdersManager object.
  2. Create new discount criterion.
    Create a new instance of the DiscountCriteria class by calling the CreateDiscountCriteria method.
  3. Associate the criterion with the discount.
    To do this, set the Parent property of the DiscountCriteria instance to the instance of the discount. Then, add the DiscountCriteria instance to the AdditionalCriteria collection of the discount.
  4. Set the properties of the discount criterion.
    Specify either the ID of the role or the ID of the user the criterion applies to. If you want to specify more than one user or role, or combine them, create separate criteria for each ID.
  5. Save the changes.
    Save the changes to the orders manager.

Use the following code samples:

Create discount criterion for a role

Create discount criterion for a user

Want to learn more?

Sign up for our free beginner training. Boost your credentials through advanced courses and certification.
Register for Sitefinity training and certification.

Was this article helpful?