If you landed on this page you’re probably using one of my ‘Advanced’ plugins. All the plugins where I use ‘Advanced’ in the plugin name allows you to use conditional logic to setup when something should happen. This blog post is here to help you understand how the conditions work and get things working to your needs.
Plugins using these conditional options
This is the current list of plugins that use the conditional logic to where this blog post applies to. It could be some newer ones won’t be listed (yet) if you’re reading this in the future.
- Advanced Messages
- Advanced Pricing
- Advanced Shipping
- Extra Shipping Options
- Advanced Product Labels
- Advanced Shipping Validation
- Advanced Free Shipping
- Advanced Fees
- Advanced Shipping Packages
- Advanced Checkout Fields
Easy Digital Downloads
The available conditions depend on the plugin and what makes sense for it. I won’t be listing the conditions per plugin here, but with the plugins there’s a screenshot on their respective page showing the available conditions.
The conditions meta box
Lets really dive into the explanation of how things really work, starting with the conditions meta box.
This is the conditions area where all the conditions are listed in. This meta box is usually listed at the top of the page. The conditions in this meta box determine IF the action of the plugin should be applied. For example, for the Advanced Fees plugin it determines when a fee should be applied or not.
In order to have it apply the fee, ALL conditions in at least one condition group should be matched.
The conditions meta box can hold multiple condition groups. A condition group is the collection of one or multiple conditions in the grey boxed area as shown below.
All the conditions inside the same condition group are matched as ‘AND’. Condition groups themselves are matches as ‘OR’.
Adding a new condition group
Adding a new condition group can be done using the “Add ‘Or’ group’ button at the bottom of the conditions meta box.
In the screenshot below the fee will be applied when;
– The ‘subtotal is less then $100’ AND is their ‘country is United States’
– When their ‘subtotal is less then $200’ AND their ‘country is Canada’
Duplicating and deleting condition groups
When you over over a condition group, in the top right corner you’ll get see two action links: ‘Delete’ and ‘Duplicate’. Use these action to manage your condition groups more easily and quicker.
Adding conditions to a condition group
Use the ‘+ Add condition’ button at the bottom to add a new condition to that specific condition group.
The ‘-‘ button on the right of a condition is used to remove a condition. Note that these will only be visible when you hover over a condition.
A single condition consists out of three parts; the condition key, operator and value.
Condition key is a list of field you can choose to match against. For example the user role, country, subtotal, payment gateway etc.
Operator is how the condition will be matched, this can be ‘Equal to’, ‘Not equal to’, ‘Greater or equal to’, ‘Less or equal to’. Note that the latter two options include the value amount itself, so if you want to make ranges, make sure you do it like ‘1~10’, ‘10.01~20’, ‘20.01~30’ etc.
Value is a dropdown or text field where you enter the value you want to match against.
As noted earlier, all the conditions in a condition group are matched in a ‘AND’ fashion, this means all conditions in a condition group must match. This doesn’t mean that the conditions are combined together. The conditions are matched separately from one another.
For example, if you setup a ‘Quantity – greater or equal – 5’ condition and a ‘Contains category – equal to – A’ condition in one condition group, it does not mean that the cart should contain 5 products of category A. It means that the cart should contain a Category A product, and at least 5 quantity in total.
Most conditions have a question mark icon to the right of it. When hovering over this a popup will show explaining how the selected condition works.
It is possible to add your own custom conditions to the plugin. This does require some programming skills to do so.
If you’d like to hire me to create a custom condition for you, you can reach out to me through the contact form.
Post a comment below if you have any improvements in mind for the conditions, or if something is missing in this post. You can also mail me directly through the contact form.