Order form with either carbon fields or ACF


Hello All,

I need to build an order form for a website and I'd like to know what's the trick to allow me to use a repeater type field group on that form. It's gonna be used on the frontend by future customers, and I don't want to force the creation of an actual WP user.

Any help is appreciated.


Hey Marc,

Well there are many frontend form builders out there. Carbon fields is a great tool for backend fields but from what I know the frontend forms are not yet fully supported. ACF has front end fields support as you can read in this article.

Then you have other forms plugin such as Ninja Forms or Gravity Forms. I personally don't use these products and can't give my opinion on whether they are good products or not, I just know they are popular which doesn't mean they are good.

Maybe other users will share their experiences using form plugins 🙂

Have fun,


Hello Thierry, I have tried Advanced Custom Fields Pro and their front-end support looks VERY promising (using acf_form_head() and acf_form() functions).

I will post here once I have more information.

Thanks a lot for your help.

Note: it's a shame Carbon Fields does not have support for this yet...


For anyone interested in how to actually use this, here is the template file I used to achieve this:

<?php
/* Template Name: Event Registration */

acf_form_head();
get_header();

$ev_id = $_GET['evid'];
if (!$ev_id) {
  error_out('You need to provide an Event ID for which you register', 'Error: missing Event ID');
}
$event = get_post($ev_id);
$title = $event->post_title;

$options = array(
        'id' => 'event-registration',
        'post_id' => 'new_post',
        'new_post' => array(
         'post_type'=>'registration',
          'post_title'=>$title,
         'post_status'=>'draft',
         'post_parent'=>$ev_id
     ),
        'field_groups' => array('sa_registration_data'),
        'submit_value' => ucfirst(__("soumettre", 'azura')),
);
?>
<div class="section_title">
  <div class="info_title">
      <div class="container">
          <div class="row-fluid">
              <div class="span12 border_title">
                  <h1><?php echo $title ?></h1>
              </div>
          </div>
      </div>
  </div>
</div>

<div>
  <div class="container">
    <h3><?php echo __("Formulaire d'inscription", 'azura') ?></h3>
    <?php acf_form($options); ?>
  </div>
</div>
<?php
wp_footer();

And my Custom Post Type with the Advanced Custom Fields:

   register_post_type( 'registration',
     array(
          'label' => $registration_labels['singular_name'],
         'labels' => $registration_labels,
         'public' => false,
          'show_ui' => true,
          'has_archive' => false,
         'menu_position' => 23,
          'supports' => false,
      )
   );

    register_field_group(array (
      'key' => 'sa_registration_data',
      'title' => ucfirst(__("DĂ©tails de l'inscription", 'azura')),
      'fields' => array (
        array (
          'type' => 'text',
          'key' => 'sa_register_company',
          'name' => 'sa_register_company',
          'label' => ucfirst(__('compagnie','azura')),
          'required' => 1,
        ),
        array (
          'type' => 'repeater',
          'key' => 'sa_register_participants',
          'name' => 'sa_register_participants',
          'label' => ucfirst(__('participants','azura')),
          'required' => 1,
          'row_min' => 1,
          'min' => 1,
          'layout' => 'table',
          'button_label' => ucfirst(__('ajouter un participant', 'azura')),
          'sub_fields' => array (
            array (
              'type' => 'text',
              'key' => 'firstname',
              'name' => 'firstname',
              'label' => ucfirst(__('prénom','azura')),
              'required' => 1,
            ),
            array (
              'type' => 'text',
              'key' => 'lastname',
              'name' => 'lastname',
              'label' => ucfirst(__('nom de famille','azura')),
              'required' => 1,
            ),
            array (
              'type' => 'text',
              'key' => 'title',
              'name' => 'title',
              'label' => ucfirst(__('fonction','azura')),
              'required' => 1,
            ),
            array (
              'type' => 'text',
              'key' => 'email',
              'name' => 'email',
              'label' => ucfirst(__('courriel','azura')),
              'required' => 1,
            ),
            array (
              'type' => 'text',
              'key' => 'phone',
              'name' => 'phone',
              'label' => ucfirst(__('téléphone','azura')),
              'required' => 0,
            ),
          ),
        ),
        array (
          'type' => 'checkbox',
          'key' => 'sa_register_topics',
          'name' => 'sa_register_topics',
          'label' => __('Je suis intéressé aux sujets suivants', 'azura'),
          'return_format' => 'array',
          'required' => 0,
        ),
        array (
          'type' => 'text',
          'key' => 'sa_register_reference',
          'name' => 'sa_register_reference',
          'label' => ucfirst(__('je suis référé par', 'azura')),
          'required' => 0,
        ),
      ),
      'location' => array (
        array (
          array (
            'param' => 'post_type',
            'operator' => '==',
            'value' => 'registration',
            'order_no' => 0,
            'group_no' => 0,
          ),
        ),
      ),
      'options' => array (
        'position' => 'normal',
        'layout' => 'default',
        'hide_on_screen' => array (
          0 => 'custom_fields',
          1 => 'comments',
          2 => 'revisions',
          3 => 'tags',
          4 => 'categories',
        ),
      ),
      'menu_order' => 0,
    ));

Thanks for sharing Marc!

Write a reply

Login or register to write a reply, it's free!