Skip to content

Field Conditions Reference ​

Conditions let each field decide when it should be visible — based on what the customer has already entered or selected in the same Option Group. This page is a focused reference for how conditions work at the field level.

For a full walkthrough with examples, see Conditional Visibility.


The Conditions Tab ​

Every field in the Addon Builder has a Conditions tab (also labelled "Visibility" in the UI). Open it by expanding any field and clicking the Conditions tab.

The Conditions tab inside an expanded field row in the Addon Builder, showing the Enable toggle, Action, Match Type, and two configured rules


How to Set Up Conditions ​

Step 1 — Enable Conditions ​

Toggle Enable Conditional Logic to on. The rule builder appears.

Step 2 — Choose an Action ​

ActionMeaning
Show this field when…Field is hidden by default — appears only when all/any conditions are met
Hide this field when…Field is visible by default — disappears when all/any conditions are met

Step 3 — Match Type ​

Match TypeLogic
ALLEvery rule must pass (AND logic)
ANYAt least one rule must pass (OR logic)

Step 4 — Add Rules ​

Each rule watches another field in the same group:

PartDescription
FieldThe field to watch (target field)
OperatorHow to compare the value
ValueWhat value to compare against

Operators ​

String & Choice Operators ​

OperatorWorks For
== (equals)Exact match — select, radio, single checkbox (1), text
!= (not equals)Does not match
containsValue is included in a multi-checkbox selection
not containsValue is not in a multi-checkbox selection
is emptyNo value has been entered or selected
is not emptyA value exists

Numeric Operators ​

OperatorWorks For
> (greater than)Number inputs
< (less than)Number inputs
>= (greater than or equal)Number inputs
<= (less than or equal)Number inputs

Field Values to Use in Conditions ​

Different field types submit different values — use these to write accurate condition rules:

Field TypeValue to compare
SelectThe option's value property (e.g. large)
RadioThe option's value property
Single Checkbox1 when checked, empty string when unchecked
Multi-CheckboxUse contains / not contains with any single option value
Text / Textarea / EmailThe exact text typed, or is empty / is not empty
NumberA numeric string — use numeric operators (>, <, ==)
Color SwatchThe swatch's value property
Image SwatchThe swatch's value property

What Happens to Hidden Fields ​

When a field is hidden by its conditions:

AreaBehaviour
FrontendField fades out or is absent from the DOM with class ob-hidden
ValidationSkipped — a hidden required field will NOT block add-to-cart
PricingExcluded — a hidden priced field adds $0.00
Cart / OrderNot saved — hidden fields produce no order item metadata
StockNot deducted — hidden stock-linked fields do not reduce inventory

This is enforced server-side by ConditionEvaluator.php, so it cannot be bypassed by disabling JavaScript.

Display-Only Fields Cannot Be Triggers

Static Content, Separator and Heading cannot be selected as the watched field in a rule.

They submit no value, so every comparison would run against an empty string — is empty and == "" would match permanently, and every other operator would never match. Either way the rule tells you nothing.

If a rule saved by an older version still points at one of these, it is ignored by the browser and the server alike. The builder keeps showing it, marked (no longer supported), so you can see and remove it rather than having it silently rewritten. A group whose rules are all ignored this way behaves as though conditional logic were switched off, and the field stays visible.

Chained Conditions Cascade

If a field you are watching is itself hidden by its own conditions, its value counts as empty — exactly what the customer sees on the page. A hidden trigger field therefore cannot indirectly reveal a field further down the chain. The server re-evaluates this cascade when the product is added to the cart, so it holds even if the submitted form data is tampered with.


Initial Render (No Flicker) ​

When the product page first loads, OptionBay calculates the initial visibility of every conditional field on the server before sending HTML to the browser. Fields that start hidden receive the CSS class ob-hidden inline, preventing a visible flash before JavaScript initialises.


Limitations ​

  • Conditions can only watch fields within the same Option Group — cross-group conditions are not supported
  • A field cannot create a condition that watches itself
  • Circular conditions (Field A depends on B, B depends on A) are not validated in the builder — set these up carefully

Quick Examples ​

Show a text field only if a checkbox is ticked ​

PartValue
ActionShow this field when…
MatchALL
FieldAdd engraving?
Operator== (equals)
Value1

Hide a note field if "In-store pickup" is selected ​

PartValue
ActionHide this field when…
MatchALL
FieldDelivery Method
Operator== (equals)
Valuepickup

Show an upsell only if the order is 5 or more units ​

PartValue
ActionShow this field when…
MatchALL
FieldQuantity Needed
Operator>= (greater than or equal)
Value5

Show a discount field if EITHER promo OR loyalty tier is set ​

PartValue
ActionShow this field when…
MatchANY
Rule 1 FieldPromo Code
Rule 1 Operatoris not empty
Rule 2 FieldLoyalty Tier
Rule 2 Operatorcontains
Rule 2 Valuegold

Released under the GPL-2.0+ License.