Repeat Rules are useful when you want to repeat a section or a field based on a certain property of the checkout page. The property value will be used to determine how many times the section or field should be repeated. The property value should resolve to a number.
You can repeat section & fields based on:
- Product quantity
- Cart count
General instructions to set repeat rules
This section will explain the common steps to set repeat rules.
To set repeat rules:
- Navigate to the WooCommerce → Checkout Form → Checkout Fields page.
- Open the field/section property form popup.
- Click on the Add Field button to open the popup form if you are setting repeat rules for a new field.
- Click on the Edit Field button to open the popup form if you are setting repeat rules for an existing field.
- Click on the Add New Section button to open the popup form if you are setting repeat rules for a new section that you are creating.
- Click on the Edit Section button to open the popup form if you are setting repeat rules for an existing section.
Repeat rule based on cart quantity
Repeat field or section N number of times, where N is the cart quantity.
Repeat rule based on product quantity
Repeat field or section N number of times, where N is the quantity of a particular product.
Note: Enable/Disable the below options based on your needs while setting up repeat rules for the default and custom sections.
Start indexing from parent: Enable the option to start the index from the parent section.
Inherit Cart & User based display rules: By default, this feature is enabled. It applies the Cart & User based display rules of the parent section to all the repeated sections.
If the feature is not needed, disable this behavior by unchecking the checkbox.
Inherit Fields based display rules: It inherits the field-based display rules of the parent section to all the repeated sections. Enable or disable the feature based on your needs.
For example, a travel agency only needs to display the passport number textbox if the customer’s age is eighteen or above. Once the feature is enabled, it displays the passport textbox based on the field value and gets repeated in the required areas.
Adjust display rules based on fields in the same section: To set rules based on the fields of that particular section.
For example, a travel agency has three customers of different age groups. If one among them is below eighteen, he/she does not need to display a passport field. Here, the rules can be set based on the field value of each customer.