title: Custom Field in WooCommerce variations
body: <p>I am trying to find the solution of get the custom field variation data in a front end. I am not sure how to get the variation id on changing the list box of variation product. For example variable product as color contain red, blue, green. I added the custom field for all the color combination. </p>
  
  <p>Here is the code that I tried (<a href="http://www.remicorson.com/woocommerce-custom-fields-for-variations/" rel="nofollow noreferrer">source</a>)</p>
  
  <pre><code>add_action('woocommerce_product_after_variable_attributes', 'variable_fields', 10, 2);
  //JS to add fields for new variations
  add_action('woocommerce_product_after_variable_attributes_js', 'variable_fields_js');
  //Save variation fields
  add_action('woocommerce_process_product_meta_variable', 'save_variable_fields', 10, 1);
  
  /**
   * Create new fields for variations
   *
   */
  function variable_fields($loop, $variation_data) {
      ?&gt;
  
      &lt;tr&gt;
          &lt;td&gt;
              &lt;?php
  // Select
              woocommerce_wp_select(
                      array(
                          'id' =&gt; '_select[' . $loop . ']',
                          'label' =&gt; __('My Select Field', 'woocommerce'),
                          'description' =&gt; __('Choose a value.', 'woocommerce'),
                          'value' =&gt; $variation_data['_select'][0],
                          'options' =&gt; array(
                              'one' =&gt; __('Option 1', 'woocommerce'),
                              'two' =&gt; __('Option 2', 'woocommerce'),
                              'three' =&gt; __('Option 3', 'woocommerce')
                          )
                      )
              );
              ?&gt;
          &lt;/td&gt;
      &lt;/tr&gt;
  
      &lt;?php
  }
  
  /**
   * Create new fields for new variations
   *
   */
  function variable_fields_js() {
      ?&gt;
  
      &lt;tr&gt;
          &lt;td&gt;
              &lt;?php
  // Select
              woocommerce_wp_select(
                      array(
                          'id' =&gt; '_select[ + loop + ]',
                          'label' =&gt; __('My Select Field', 'woocommerce'),
                          'description' =&gt; __('Choose a value.', 'woocommerce'),
                          'value' =&gt; $variation_data['_select'][0],
                          'options' =&gt; array(
                              'one' =&gt; __('Option 1', 'woocommerce'),
                              'two' =&gt; __('Option 2', 'woocommerce'),
                              'three' =&gt; __('Option 3', 'woocommerce')
                          )
                      )
              );
              ?&gt;
          &lt;/td&gt;
      &lt;/tr&gt;
  
      &lt;?php
  }
  
  /**
   * Save new fields for variations
   *
   */
  function save_variable_fields($post_id) {
      if (isset($_POST['variable_sku'])) :
  
          $variable_sku = $_POST['variable_sku'];
          $variable_post_id = $_POST['variable_post_id'];
  // Text Field
          $_select = $_POST['_select'];
          for ($i = 0; $i &lt; sizeof($variable_sku); $i++) :
              $variation_id = (int) $variable_post_id[$i];
              if (isset($_select[$i])) {
                  update_post_meta($variation_id, '_select', stripslashes($_select[$i]));
              }
          endfor;
  // Checkbox
  
      endif;
  }
  </code></pre>
  
  <p>It all saving correctly but in the front end i can't get the value of the corresponding variation but i am still finding a solution. 
  Like in a front end if you change the variation it changing the price simultaneously. I am want to display another information on top of the variation price. Is that possible to do in woocommerce. 
  Here is the screenshot.</p>
  
  <p><strong>Backend Variable Product</strong>
  <img src="https://i.stack.imgur.com/qhhMM.png" alt="backend variable product"></p>
  
  <p><strong>Expected Output in Front End</strong>
  <img src="https://i.stack.imgur.com/TiaHi.png" alt="enter image description here"></p>
  
  <p>How to show the custom field data on changing the list box?</p>