title: Show WooCommerce custom checkout fields using a WP_Query
body: <p>I use a plugin to create some custom B2B fields. Now I need these custom made fields to be shown at the checkout page.</p>
  <pre><code>function add_custom_b2b_fields_checkout( $fields ){
  
    $args = array(
      'post_type'           =&gt; 'afreg_fields',
      'post_status'         =&gt; 'publish',
      'posts_per_page'      =&gt; '99',
      'orderby'             =&gt; 'name',
    );
  
    $get_b2b_fields = new WP_Query( $args );
  
    if ($get_b2b_fields-&gt;have_posts()) : while ($get_b2b_fields-&gt;have_posts()) : $get_b2b_fields-&gt;the_post();
      $fields['billing'][$get_b2b_fields-&gt;post_name] = array(
          'type'              =&gt; 'text',
          'label'             =&gt; get_the_title(),
          'placeholder'       =&gt; __(&quot; &quot;, &quot;woocommerce&quot;),
          'class'             =&gt; array('b2b-field'),
          'required'          =&gt; false,
      );
      endwhile;
      return $fields;
    endif;
  }
  add_filter( 'woocommerce_checkout_fields', 'add_custom_b2b_fields_checkout' );
  </code></pre>
  <p>The code works nice almost. But it shows only the last field, as if the <code>while</code> run correctly but the <code>return $fields</code> shows only the first custom field instead of all of them.</p>
  <p>How can I show all the fields instead of just one? I tried adding a <code>.=</code> at the <code>$fields</code> but that didn't work.</p>