title: Conditional custom checkout fields validation issue in Woocommerce
body: <p>I have a checkbox which if checked opens a drop down field (requirements). If you try and send the Woocommerce order it conditionally checks if the field has content, if it doesn't it returns an error. </p>
  
  <p>This all works accept when the requirements field does have information input it still treats it as not having content and returns the error. </p>
  
  <p>As this is the basic way that forms should work I don't understand why I'm getting such a result. Here's the code:</p>
  
  <pre><code>/**
   * Add a message field to the WC checkout
   */
  add_action( 'woocommerce_before_checkout_form', 'custom_checkout_field' );
  
  function custom_checkout_field( $checkout ) {
  
      echo '&lt;div id="message"&gt;&lt;h3&gt;' . __( '&lt;i class="fas fa-envelope"&gt;&lt;/i&gt; Message' ) . '&lt;/h3&gt;&lt;p style="margin: 0 0 8px;"&gt;Would you like to leave a message?&lt;/p&gt;';
  
          woocommerce_form_field( 'checkbox', array(
              'type'  =&gt; 'checkbox',
              'class' =&gt; array( 'msg-checkbox' ),
              'label' =&gt; __( 'Yes' ),
          ), $checkout-&gt;get_value( 'checkbox' ) );
  
      woocommerce_form_field( 'requirements', array(
          'type'          =&gt; 'text',
          'class'         =&gt; array('msg'),
          'label'         =&gt; __('Please input your message.'),
          'placeholder'   =&gt; __(''),
          ), $checkout-&gt;get_value( 'requirements' ));
  
      echo '&lt;/div&gt;';
  
  }
  
  /**
   * Process checkout with additional custom field
   */
  add_action('woocommerce_checkout_process', 'custom_checkout_field_process');
  
  function custom_checkout_field_process() {
  
      // Check if set, if not add an error.
  
      if(isset($_POST['checkbox']) &amp;&amp; ( empty($_POST['requirements'])));
  
          wc_add_notice( __( 'Please let us know what you would like to do' ), 'error' );
  }
  </code></pre>
  
  <p>I hope that makes sense. basically it works to a point but the validation for the input field doesn't work when it has content.</p>
  
  <p>Thanks.</p>