How to build validation rules?
We'll cover step-by-step settings of validation rules in this article. Firstly, by using a dedicated Validation Rules section in the dashboard, and alternatively, by using a Campaign Manager where you can build and add validation rules on-the-go to a newly created code/promotions.
- How to create validation rules in the Campaign Manager.
- How to prepare validation rules in the Validation Rules section.
This article shows how to build a validation rule and add validation rules to a campaign/promotion. Visit this article to see a complete list of limits and rules that you can create with the Validation Rules Builder.
Build a rule while creating a new campaign
Firstly you need to run the Campaign Manager and choose a campaign type you'd like to create:
Go through the first two stages of a campaign creation process. In the 3rd stage of the Manager, you can add validation rules - all redemption limits attached to the codes. You can create new limits from scratch (1) or choose from already created sets of rules (2).
By default, the Manager shows you a basic rules builder. It covers the most popular limits for your campaigns.
How to build a rule with basic rules builder
Click Create validation rules to open a basic validation rules builder.
Here's a list of basic rules related to:
- Customer activity
You can target specific customer segments and/or exclude particular segments from your promotion.
2. Attributes match: order, products and redemption metadata
In this section, you can build promotion limits based on metadata attributes. Please note that to use metadata in validation rules, you need to attach these attributes in the metadata schema first. Click here to learn more.
3. Discounted products
You can choose which products or SKUs from your inventory can/can't be discounted. While redeeming the code, Voucherify will check which items from the customers' cart are in the Discount and Exclude list. If you leave the list empty, the discount will be applied to all products from the cart.
In this section, you can set the following rules:
- Define total value of all orders made in the campaign
- Define total value of the discount that can be applied in the campaign (on all orders)
- Define redemptions limit per campaign
- Limit redemptions per customer (per code, per day, per campaign)
With this option you can create the following validation rules :
- Total amount of order is more than, exactly or less than X amount
- Contains product X
- Contains SKU
Please note that to use product-based rules, you need to add your inventory to your Voucherify account. Read more here.
If you won’t find needed rules, go to the advanced rules builder.
How to build rules with advanced rules builder
First, change the basic builder to advanced mode.
The advanced builder gathers are available validation rules. Follow this guide to see the list of all validation rules supported in Voucherify.
Advanced rules builder
1. Add a name for your validation rule/set of rules (they will be automatically saved in the Validation Rules Dashboard section).
Define the logic between rules (1). Additionally, you can specify a fallback error message that will be used when there is no error message defined for the particular rule (2).
2. There are six categories of rules to choose from:
Expand the available rules from the category you're interested in and build a restriction using available operators.
3. Confirm with ADD. All active rules will be visible on the grey background below each category.
You can define custom error messages per validation rule which are going to be returned when code redemption fails due to the request not meeting validation rule criteria.
Remember to confirm the rules with Save.
Build a rule via the Validation Rules Dashboard section
This way of creating rules comes in handy when you want to prepare limits for future campaigns. Go to the Validation Rules section in the dashboard and choose Plus to create a new set of rules.
1. Add a name for your validation rule/set of rules (they will be automatically saved in the Validation Rules dashboard section).
Context helps to define a proper list of conditions, that can be used to validate specific resources. General usage means that you can assign such validation rule to any resource.
2. In the next step, add rules using the basic or advanced builder. The rules builder in this section is the same engine that you use while creating limits in the Campaign Manager:
3. In the last section you can see a summary of added rules and their details, click Save to confirm.
You can always update existing rules by clicking edit next to their name in the Validation Rules dashboard section.