title: Cutsom Checkbox field in woocommerce product data metabox
body: <p>I have added a checkbox to a Woocommerce product page. When I check the box and save it, the box does have the check mark in it and adds &quot;yes&quot; to the field. However, when I try to un-check the checkbox it does not remove the check mark and the field stay as &quot;yes&quot;. In some cases the reverse happens, I can get the check mark to be removed but when I try to check the checkbox again it won't check. It doesn't appear to update.</p>
  <pre><code>  
  function wdc_add_checkbox_to_products() {
      global $woocommerce, $post;
      $term = 'cheque'; // Product category term slug
                 
      if ( (has_term( $term, 'product_cat' ) )){   
          woocommerce_wp_checkbox( array( 
          'id' =&gt; 'wdc_checkbox',
          'label' =&gt; 'Include in List',
          'wrapper_class' =&gt; ''
      ) );
      echo '&lt;input type=&quot;hidden&quot; name=&quot;wdc_checkbox_nonce&quot; value=&quot;' . wp_create_nonce() . '&quot;&gt;';  
     
      }
  }
  
  add_action( 'save_post_product', 'wdc_save_checkbox_textbox_to_post_meta', 20, 1 );
    
  function wdc_save_checkbox_textbox_to_post_meta( $post_id ) {
      if ( ! isset( $_POST[ 'wdc_checkbox_nonce' ] ) ) {
          return $post_id;
      }
      if ( ! wp_verify_nonce( $_POST[ 'wdc_checkbox_nonce' ] ) ) {
          return $post_id;
      }
      if ( defined( 'DOING_AUTOSAVE' ) &amp;&amp; DOING_AUTOSAVE ) {
          return $post_id;
      }
      if ( ! current_user_can( 'edit_product', $post_id ) ) {
          return $post_id;
      }
      if ( isset( $_POST['wdc_checkbox'] ) ) {
          update_post_meta( $post_id, 'wdc_checkbox', $_POST['wdc_checkbox'] );
      }
  }
  </code></pre>