Conditional Logic for Custom Fields Overview
Read about the Conditional Logic provided by the JetPlugins for Custom Fields and Meta boxes.
Before you start check tutorial requirements:
- Elementor (Free version) or Block editor (Gutenberg)
- JetEngine plugin installed and activated
The Conditional Logic options are available for meta fields and meta boxes developed by the JetEngine plugin and for the form fields created by the JetFormBuilder plugin. This feature helps schedule opening hours and appointments, provides additional information on products for some users, shows delivery types for a shop manager to choose from while adding a product, etc.
Conditional Logic for JetPlugins Custom Fields allows:
- showing/hiding, setting value(s) for 18+JetEngine meta fields if one or some conditions are met;
- applying one or some logic operators simultaneously for one meta field or a set of meta fields;
- applying logic operator(s): Equal, Not Equal, In the List, Not In the List;
- compare custom field values with the pre-set data (Value to Compare bar).
Conditional Logic for JetPlugins MetaBoxes allows:
- showing/hiding visibility of meta boxes for different user roles and taxonomy terms;
- showing/hiding visibility of meta fields added to meta boxes (applies the visibility conditions as Include Posts, Exclude Posts, Included for User Roles, Excluded for User Roles, Post Has Taxonomy Terms, Taxonomy).
Conditional Logic for CPT Meta Fields
To set conditional logic rules for Custom Post Types, navigate to the JetEngine > Post Types of the WordPress Dashboard.
Click the Meta fields tab, unroll the meta field you need to set the conditional logic,, and scroll it down.
Press the “Conditional Logic” button to set meta field display rules.
The pop-up window will show a toggle to enable conditional logic. Move this toggle.
Press the “New Rule” button and set the conditions:
- The Field drop-down menu allows choosing the field;
- The Operator drop-down menu allows selecting the condition (i.e., Equal, Not Equal, In the List, Not In the List) and turning on the Value field to type the necessary value.
Read the Custom Meta Fields Overview tutorial to know how to build different types of meta fields and set their visibility conditions.
Conditional Logic for Meta Boxes
To set conditional logic rules for meta boxes, navigate to the JetEngine > Meta Boxes of the WordPress Dashboard.
The Custom Meta Box Creation Guide explains more about meta box settings.
Move to the Visibility Conditions tab of the meta box you need and press the “+New Condition” button.
Specify the Visibility Conditions you need.
Read more about the Meta Boxes Visibility Conditions in this overview.
That’s all about the Conditional Logic for Custom Fields.