In version 1.2.0 and up a new field type is available to use; “Repeater”. This new field type makes it possible to setup a (group of) field that repeats itself based on a set of configured settings. For example, you can setup a specific field to be repeated for every quantity of a specific item that is in the cart.
Repeating checkout fields in WooCommerce
Using the repeater field you can configure a single field or group of fields to be repeated. This allows you to ask your customers for data per product for example. This can be useful in a scenario where for example tickets or seats are sold and require personal data to be entered per sold ticket.
Here’s an example where there is a ‘Message’ field added for every fruit basket that is present in the cart.
Repeat every …
There are currently 3 options which can be used to configure the repeater field interval.
Multiply with product quantity
With this option you can select a specific product where the set repeater field should be multiplied with. This is based on the quantity of the given product that is in the cart, including variation quantity. It is also possible to set a specific variation in this setting to only multiply it with the quantity of set variation.
Multiply with category quantity
This option allows you to select a category which it should multiply with. This adds up the quantity of each product in the cart that has this category.
Multiply with shipping class quantity
This works in a similar fashion as the category option, it adds up the quantity of all the items which has the shipping class, and multiplies the repeater fields with that.
Please feel free to share if you have any other suggestions on repeating fields.
Configuring the repeater fields
Configuring the repeater fields in Advanced Checkout Fields is really easy. With a new or existing field you can select the ‘Repeater’ field type. After a bit of loading in the ‘Field options’ section you’ll see two specific options:
1) Quantity
2) Fields
The quantity option has already been explained above in theĀ Repeat every … section. The ‘Fields’ option should be self-explanatory, as it works exactly the same as the existing checkout fields sections. The only things that are not possible to configure in those fields is a nested repeater field, and conditional fields.
Within the ‘Name’ setting of a field you can use ‘%d’ to display the quantity number of the field.
A last screenshot to show of multiple fields: