title: How do I validate agree terms checkbox for woocommerce registration form?
body: <p>I have stmbled into a bit of a problem with the woocommerce registration form. I wanted to add a agree to the terms checkbox that would actually work.</p>
  
  <p>I added the code that shows the checkbox in form-login.php (from the templates/my account folder).</p>
  
  <p>I tried to modify the code in wc-user-functions.php and class-wc-form-handler.php from includes folder and now it does not recognize when the user checks the box. It gives me the Please accept terms error every time regardless if i check the box or not.</p>
  
  <p>Does anyone know where is my mistake?</p>
  
  <p>form-login.php added code</p>
  
  <pre><code>&lt;p class="form-row form-row-wide"&gt;
              &lt;label for="accept_terms" class="inline"&gt;&lt;span class="required"&gt;&lt;/span&gt;&lt;/label&gt;
              &lt;input name="accept_terms" type="checkbox" id="accept_terms" value="empty";/&gt; 
              &lt;?php _e( 'Am citit si sunt de acord cu' ); ?&gt; &lt;a href="&lt;?php echo "http://................." ?&gt;"&gt;&lt;?php _e( 'termenii si conditiile', 'woocommerce' ); ?&gt;&lt;/a&gt;
          &lt;/p&gt;
  </code></pre>
  
  <p>wc-user-functions.php added code</p>
  
  <pre><code>// Check the accept terms
  if ( empty( $accept_terms ) )  {
      return new WP_Error( 'registration-error-accept-terms', __( 'Please accept terms', 'woocommerce' ) );
  } 
  </code></pre>
  
  <p>wc-class-form-handler.php modified code</p>
  
  <pre><code>public static function process_registration() {
      if ( ! empty( $_POST['register'] ) &amp;&amp; isset( $_POST['_wpnonce'] ) &amp;&amp; wp_verify_nonce( $_POST['_wpnonce'], 'woocommerce-register' ) ) {
          $username = 'no' === get_option( 'woocommerce_registration_generate_username' ) ? $_POST['username'] : '';
          $password = 'no' === get_option( 'woocommerce_registration_generate_password' ) ? $_POST['password'] : '';
          $email    = $_POST['email'];
      $accept_terms = $_POST['accept_terms'];
  
          try {
              $validation_error = new WP_Error();
              $validation_error = apply_filters( 'woocommerce_process_registration_errors', $validation_error, $username, $password, $email, $accept_terms);
  
              if ( $validation_error-&gt;get_error_code() ) {
                  throw new Exception( $validation_error-&gt;get_error_message() );
              }
  
              // Anti-spam trap
              if ( ! empty( $_POST['email_2'] ) ) {
                  throw new Exception( __( 'Anti-spam field was filled in.', 'woocommerce' ) );
              }
  
              $new_customer = wc_create_new_customer( sanitize_email( $email ), wc_clean( $username ), $password);
  
              if ( is_wp_error( $new_customer ) ) {
                  throw new Exception( $new_customer-&gt;get_error_message() );
              }
  
              if ( apply_filters( 'woocommerce_registration_auth_new_customer', true, $new_customer ) ) {
                  wc_set_customer_auth_cookie( $new_customer );
              }
  
              wp_safe_redirect( apply_filters( 'woocommerce_registration_redirect', wp_get_referer() ? wp_get_referer() : wc_get_page_permalink( 'myaccount' ) ) );
              exit;
  
          } catch ( Exception $e ) {
              wc_add_notice( '&lt;strong&gt;' . __( 'Error', 'woocommerce' ) . ':&lt;/strong&gt; ' . $e-&gt;getMessage(), 'error' );
          }
      }
  }
  </code></pre>
  
  <p>Any help would be greatly appreciated!</p>