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

Increase your Sitefinity skills by signing up for our free trainings. Get Sitefinity-certified at Progress Education Community to boost your credentials.

Web Security for Sitefinity Administrators

The free standalone Web Security lesson teaches administrators how to protect your websites and Sitefinity instance from external threats. Learn to configure HTTPS, SSL, allow lists for trusted sites, and cookie security, among others.

Foundations of Sitefinity ASP.NET Core Development

The free on-demand video course teaches developers how to use Sitefinity .NET Core and leverage its decoupled architecture and new way of coding against the platform.

Was this article helpful?