title: Woocommerce registeration check if referral code is valid
body: <p>I am looking to add a check to my woocommerce registration form to check if a referral code exists, that is set as a custom field (repeater) in the backend. It is currently set up with Advanced Custom Fields and set on an options page. It should check if code is in the repeater fields otherwise refuse registration. The code then needs to be added to the user and shown in the user backend.</p>
  
  <p>I have tried to manipulate terms and conditions code on registration but havent got anywhere. Thanks</p>
  
  <p>This is my ACF code to grab the valid codes for validation.</p>
  
  <pre><code>&lt;?php
  
  // check if the repeater field has rows of data
  if( have_rows('referralcode', 'option') ):
  
      // loop through the rows of data
      while ( have_rows('referralcode', 'option') ) : the_row();
  
          // display a sub field value
          the_sub_field('referralvalue', 'option');
  
      endwhile;
  
  else :
      // no rows found
  endif;
  
  ?&gt;
  </code></pre>