Display Rules

Updated

Display rules are a set of conditions that can be set for sections & fields to control their display on the checkout page. This means you can set certain conditions for showing or hiding fields & sections on the checkout page.

This article will help you to understand display rules settings, and will also explain all the different types of conditions available for setting display rules.

In this article

General instructions to set display rules

This section will explain to you the common steps to set display rules.

To set display rules for checkout fields or sections:

  1. Navigate to the WooCommerce → Checkout & Register Editor.

  2. Open the field/section property form popup.

    • 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 button to open the popup form if you are setting display rules for an existing field.
    • Click on the Add New Section button to open the popup form if you are setting display rules for a new section that you are creating.
    • Click on the Edit Section button to open the popup form if you are setting display rules for an existing section.
  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, the first one will be validated before loading the checkout page. And the other one will be 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, click on the Save Field button to save the settings.

woocommerce checkout regsiter field editor fields

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. User role equal to

  2. User role not equal to

 

Example # 1:Show field xyz only for “Shop Manager”

woocommerce checkout regsiter field editor fields

Example # 2:Hide field xyz for “Shop Manager” and “Administrator”

woocommerce checkout regsiter field editor fields conditions

Conditions based on cart totals

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

  1. Cart total equal to

  2. Cart total greater than

  3. Cart total less than

  4. Cart subtotal equal to

  5. Cart subtotal greater than

  6. Cart subtotal less than

 

Example #1:Show field xyz if the cart total amount is between $200 & $300

woocommerce checkout regsiter field editor fields

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 products in the cart.

  1. Cart contains

  2. Cart not contains

  3. Cart only contains

 

Example #1:Show field xyz if cart contains the product T-Shirt with Logo

woocommerce checkout regsiter field editor fields

Conditions based on product categories

  1. 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 products in the cart.

    1. Cart contains

    2. Cart not contains

    3. Cart only contains

     

    Example #1:Show field xyz if the cart contains products only from the category T-Shirt

woocommerce checkout regsiter field editor email fields conditions

Conditions based on other field's value

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

 

  1. Is empty

  2. Is not empty

  3. Value equals to

  4. Value not equals to

  5. Value greater than

  6. Value less than

  7. Date equals to

  8. Date not equals to

  9. Date after

  10. Date before

  11. Day equals to

  12. Day not equals to

  13. Is checked

  14. Is not checked

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

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

woocommerce checkout regsiter field editor email fields
  1. From the Select box, pick the specific field based on which the rule has to be set.

  2. Choose the required condition from the next drop-down.

  3. Enter the option value in the input field at the right.

  4. Use the OR function to set condition rules based on more than one option text.

  5. Save the changes made.

Conditions based on option value

For Select and Radio

woocommerce checkout regsiter field editor country and address fields
  1. From the Select box, pick the specific field based on which the rule has to be set.

  2. Choose the required condition from the next drop-down.

  3. Enter the option value in the input field at the right.

  4. Use the OR function to set condition rules based on more than one option text.

  5. Save the changes made.