ThemeHigh
  • Plugins
  • Bundles New
    Documentation
    WooCommerce Essential Bundle
    Feature request
    WooCommerce Checkout page Bundle
    Translation project
    WooCommerce Product page Bundle
    Build your own Bundle
    Build Your Own Bundle (BYOB)
    New
    WooCommerce Essential Bundle
    WooCommerce Checkout page Bundle
    WooCommerce Product page Bundle
    Build Your Own Bundle (BYOB)

    Best Value

    An essential WooCommerce plugins bundle to boost your performance and sales.

    • Checkout field editor for WooCommerce - $49
    • Extra product option for WooCommerce - $39
    • Email customizer for WooCommerce - $39
    • Multistep checkout for WooCommerce - $39
    • Multiple Shipping address for WooCommerce - $39
    • Variation swatches for WooCommerce - $39
    $244$122 Only
    Know more

    Best Value

    An checkout WooCommerce plugins bundle to boost your performance and sales.

    • Checkout Field Editor for WooCommerce - $49
    • Multistep Checkout for WooCommerce - $39
    • Multiple Shipping Address for WooCommerce - $39
    $127$109 Only
    Know more

    Best Value

    An product WooCommerce plugins bundle to boost your performance and sales.

    • Extra Product Option for WooCommerce - $39
    • Variation Swatches for WooCommerce - $39
    • Email Customizer for WooCommerce - $39
    • Schedule Delivery for WooCommerce - $49
    $166$119 Only
    Know more

    HOT SALE

    Your Money, Your Choice - The Savings Are On Us!

    BYOB Offer

    Get the flexibility to create your perfect plugin bundle! Pick the plugins you need and enjoy an exclusive discount —only pay for what you use!

    $100 - $149: 25% Discount

    $150 - $199: 30% Discount

    $200 - $249: 40% Discount

    Above $250: 50% Discount

    *Min 2 quantity is required to claim this offer.

    Know more
  • Documentation
  • Support
  • Partners
  • Login
  • Getting Started
    • Overview...
    • Add/Edit Custom Sections
    • Add/Edit Custom Fields
    • Add Display Styles
    • Set Tooltip Details
    • Price Fields & Types
    • Set Display Rules for Fields & Sections
    • How to Export/Import Fields & Sections Individually
  • Advanced Settings
    • Add Price Table
    • How to modify add to cart button text?
    • Add a Custom Validation Rule
    • Add a Confirm Field Validator
    • Choose a Layout Style
    • Disable "Enhanced Select(Select 2)" for select fields
    • How to post extra options as URL Parameters?
    • Use the Div tag for displaying fields
    • Backup & Import Settings
    • WPML String Translations...
  • FAQ
    • Frequently Asked Questions...
  • For Developers
    • Hooks & References...
  • Compatible Plugin & Themes
    • Plugins & Themes...

Documentation/Extra Product Option for WooCommerce/How to Set Conditional Rules for WooCommerce Product Fields?

How to Set Conditional Rules for WooCommerce Product Fields?

Last updated on September 5, 2023

 


General instructions to set display rules

To set display rules for product fields:

  1. Navigate to the WooCommerce → Extra Product Options → Product Fields page.
  2. Open the field property popup.Display_rules-fields.png– Click on the Add Field button to open the popup form if you are setting display rules for a new field.- Click on the Edit Field icon to open the popup form if you are setting display rules for an existing field.
  3. Navigate to the Display Rules tab from the popup.
  4. From this tab, you can define display rules. Here you can see two sets of rules, where the first one will be validated before loading the product page. The other one will be only validated once the page is loaded. You can add multiple conditions to each rule.
  5. Click on the AND or OR operator button to add multiple conditions and use these operators properly based on your requirement.
  6. Once the required conditions are added, save the changes made.

To set display rules for sections:

  1. Navigate to the WooCommerce → Extra Product Options → Edit/New Section.
  2. Open the section property form popup.Disply_rules-Sections.png
  3. Click on the Add New Section button to open the popup form if you are setting display rules for a new section.
  4. Click on the Edit Section button to open the popup form if you are setting display rules for an existing section.
  5. Navigate to the Display Rules popup and define the rules based on your needs as configured for extra fields.
  6. When the changes are done, save the changes made.

Conditions based on user role

Show or hide fields & sections based on user role. Below is the list of conditions available to display fields & sections based on the user role.

  1. Equal to / In
  2. Not Equal to / Not In

Example #1: Show field XYZ only for “Shop manager”.

User_role-display_fields.png

Example #2: Hide field XYZ if the user is a “Shop Manager” or an “Administrator”.

User_role_2.png


Conditions based on products

Show or hide fields & sections based on products. Below is the list of conditions available to display fields & sections based on the product.

  1. Equal to / In
  2. Not Equal to / Not In

Example #1: Show field XYZ if the product is Cap.

Products_display_rules.png


Conditions based on product categories

Show or hide fields & sections based on product categories. Below is the list of conditions available to display fields & sections based on the categories of the product.

  1. Equal to / In
  2. Not Equal to / Not In

Example #1: Show field XYZ if the product’s category is Hoodies.

Categories-display.png


Conditions based on product tags

Show or hide fields & sections based on product tags. Below is the list of conditions available to display fields & sections based on the product tags.

  1. Equal to / In
  2. Not Equal to / Not In

Example #1: Show field XYZ if the product tag is SingleColor.

Product_tags-display_rules.png


Conditions based on product variations

Show or hide fields & sections based on product variations. Below is the list of conditions available to display fields & sections based on product variation.

  1. Value equals to
  2. Value not equals to

Variable products are grouped using the product attributes function. Product attributes are briefly divided into two,

  1. Global Attributes
  2. Local Attributes

Global Attributes: Once defined, these attributes will be available to add for all the products. They will be listed in the attributes section of the product from where you can choose them from the dropdown.

Local Attributes: While global attributes are available to select throughout for all products, local attributes are those which are custom-added to a particular product from the attributes section inside the product details.


To configure the display rule based on product variations inside the local attributes.

  • In the above video, we have set the local attributes and generated its variations inside the product.
  • The Next Step is to navigate to Extra Product Option inside Products and select the field that you want to set the product variation.
  • Select the Edit field, and a corresponding window appears, Here, select the display rules.
  • Firstly, set the display rule for which product you want to set product variation for.
  • Next, select “Product variation” from the field and then select “value equals to” from the select field, and finally, include the slug inside the input field.
  • Here, the slug value is a combination of attribute name(Colors) and attribute value(Blue). (Colors: Blue)

 


Conditions based on other field’s value

This option allows you to set conditions based on other field’s values. Below is the list of conditions available to display fields & sections based on other fields’ values.

  1. Is empty
  2. Is not empty
  3. Value equals to
  4. Value not equals to
  5. Value in
  6. Contains
  7. Not contains
  8. Value greater than
  9. Value less than
  10. Value starts with
  11. Value not starts with
  12. Date equals to
  13. Date not equals to
  14. Date after
  15. Date before
  16. Day equals to
  17. Day not equals to
  18. Is checked
  19. Is not checked
  20. Match expression

Match expression 

The match expression is evaluated based on an identity check on the expression provided. It is set using regular expressions. 

When the value or regular expression provided in the field matches to the expression set in the display rules, the field is either shown or hidden based on this condition.

For example, above we have used a regular expression of email, and it should match the value entered by the user.

Conditions based on input fields (Text, Hidden, Password, and Textarea)

Follow the below steps for the field types like text, textarea, password, and hidden.

  1. Choose the Show/Hide option from the drop-down to display/hide the specific field.
  2. From the Select field textbox, choose a specific field based on which the rule needs to be set.
  3. Select the required condition from the next drop-down.
  4. Provide the conditional data that should be satisfied for that particular field.
  5. Save the changes made.

Conditions based on option value

For Select and Radio

  1. Choose Show/Hide option from the drop-down to display/hide the specific field.
  2. From the Select box, pick the specific field based on which the rule has to be set.
  3. Choose the required condition from the next drop-down.
  4. Enter the option value in the input field at the right.
  5. Use the OR function to set condition rules based on more than one option value.
  6. Save the changes made.

Option Value

Option value is a value set for the options which will be saved in the database.

Option Text

Option text is the name you assign to the option value which will be displayed in the front end .

Based on the Checkbox

Set display rules using the option ‘Is checked/ Is not checked‘. Follow the below steps to set a conditional field based on a checkbox.

  1. Choose Show/Hide from the drop-down to display or hide the field.
  2. From the Select box, pick the Checkbox field based on which the rule has to be set.
  3. Select the required condition Is Checked/Is not checked from the drop-down in the middle.
  4. Save the changes made.

Based on the Checkbox Group & Multi-Select

Here the Colour(colour_9) is the field where the condition is set. The Pink Or Blue is the value that the condition should meet.

  1. Choose Show/Hide from the drop-down to display or hide the field.
  2. From the Select box, pick the field based on which the rule has to be set.
  3. Select a suitable condition from the drop-down in the middle.
  4. Enter the option text which needs to be satisfied for the field (Enter the value in the final input field.)
  5. Use the OR function to set condition rules based on more than one option value.
  6. Use comma separator to connect the option text with AND function.

Conditions based on Date Picker & Time picker

To set a rule based on the Date picker field type:

Here the Pick up date (pickupdate) is the field where the condition is set. The 27/07/2023 is the value that the condition should meet.

  1. Insert the date in the format ‘DD/MM/YYYY’.
  2. From the Select box, pick the field based on which the rule has to be set.
  3. Choose the required condition from the dropdown like ‘Day equals to/Day not equals to’.
  4. For setting a rule based on the day of a week enter the input values as the first three letters of the day after choosing the condition. (Example: Mon instead of Monday).

Note: The date format set for the field/section in the field properties will not be validated while setting as the rule.

To set a rule based on the Time picker field type:

Here the Set a time(seta_time) is the field where the condition is set. The 12:00 is the value that the condition should meet.

  1. Enter the time in the format ‘HH:MM AM/PM’.
  2. From the Select box, pick the field based on which the rule has to be set.
  3. Choose the required condition from the dropdown like ‘value equals to/value not equals to’.
  4. Provide a specific time in the final textbox.

Note: Only the condition “equals to” and “value not equals to” will work. The time picker value entered in 24-hour format will not be validated.


Conditions based on Product Quantity

Follow the below steps while setting up a conditional rule based on the product quantity chosen:

discount_rules_based_product_quantity.png

  1. Go to Display rules, Choose Show/Hide from the display action dropdown.
  2. From the Select box, select Product Quantity.
  3. Select a suitable condition as per your requirement from the drop-down in the middle.
  4. Enter the quantity required for configuring the conditional rule in the input field at the right.

Save changes by clicking on the Save & Close.


Custom conditions

When the above-discussed options are not enough to set your required conditions, don’t worry you can set your own conditions using the below hooks.

Filter hook to set custom display rules for product fields.

apply_filters('thwepo_show_field', $show, $field_name);

Filter hook to set custom display rules for custom product sections.

apply_filters('thwepo_show_section', $show, $section_name);
Get the plugin

Quick Links

  • Try Demo
  • How to Download and Install Our Plugin ?
  • Manage License
  • Join our Facebook Community

On this page

  • General instructions to set display rules
  • To set display rules for product fields:
  • To set display rules for sections:
  • Conditions based on user role
  • Conditions based on products
  • Conditions based on product categories
  • Conditions based on product tags
  • Conditions based on product variations
  • Conditions based on other field's value
  • Match expression
  • Conditions based on input fields (Text, Hidden, Password, and Textarea)
  • Conditions based on option value
  • For Select and Radio
  • Based on the Checkbox
  • Based on the Checkbox Group & Multi-Select
  • Conditions based on Date Picker & Time picker
  • To set a rule based on the Date picker field type:
  • To set a rule based on the Time picker field type:
  • Conditions based on Product Quantity
  • Custom conditions

This article posted in Extra Product Option for WooCommerce, Getting Started, Pro Documentation

Leave a Reply Cancel reply

Your email address will not be published. Required fields are marked *

ThemeHigh

We develop innovative WordPress plugins and themes for e-commerce and other WordPress websites.

Resources
  • Documentation
  • Support
  • Blog
  • Bestsellers
  • Affiliates
  • Partners
Policy Information
  • Terms & Conditions
  • Privacy Policy
  • Support Policy
  • Refunds Policy
  • Licenses
Security
Payment Options

© 2025 ThemeHigh. All rights reserved.

Terms and conditions, features, support, pricing, and service options subject to change without notice.