title: Variable product selectors: Getting the live selected values
body: <p>In WooCommerce use the code below to add a custom label after product prices in simple and variables products:</p>
  
  <pre><code>add_filter('woocommerce_variation_price_html','prices_custom_labels', 10, 2    );
  add_filter('woocommerce_price_html','prices_custom_labels', 10, 2 );
  function prices_custom_labels( $price, $product ){
  
      // Set HERE your custom labels names
      $per_dozen = ' '. __('per dozen', 'woocommerce' );
      $per_case = ' '. __('per case (20 dozens)', 'woocommerce' );
  
  
      // 1) Variable products
      if ($product-&gt;product_type != 'simple' &amp;&amp; $product-&gt;variation_id ) {
  
          // Getting the array of existing attributes values for a variation
          $variation_attribute_value = $product-&gt;variation_data;
          // Here we keep only the last value in this array
          $last_variation_attribute_slug_value = ' ' .    end($variation_attribute_value);
  
          // Finding the word 'case' in the attribute value slug
          $has_case = strstr($last_variation_attribute_slug_value, 'case');
  
          // Setting the right displayed label depending on attribute value slug
          if( $has_case )
              $attribute_quantity_name_value = $per_case;
          else
              $attribute_quantity_name_value = $per_dozen;
  
          // Here the output price + custom label
          $price = '&lt;ins class="highlight"&gt;'.woocommerce_price( $product-   &gt;regular_price ).$attribute_quantity_name_value.'&lt;/ins&gt;';
      }
      // 2) Simple products
      else
      {
          // Here the output price + custom default label
          $price = '&lt;ins class="highlight"&gt;'.woocommerce_price( $product-  &gt;regular_price ).$per_dozen.'&lt;/ins&gt;';
      }
      return $price;
  }
  </code></pre>
  
  <p>But in variable products, I have an issue with the appended custom label in the  live displayed price. The code that I use only display after the live price "per dozen".</p>
  
  <p>I will need to get the selected value on the custom "quantity" selector to add the right label after the price:</p>
  
  <ul>
  <li>If the selected value is "Dozen" I need to display after live price " per dozen",</li>
  <li>If the selected value is "Case (20 dozens)" I need to display after live price " per case (20 dozens)".</li>
  </ul>
  
  <p>This screenshot is what I have actually for all cases:</p>
  
  <p><a href="https://i.stack.imgur.com/DoEDx.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/DoEDx.png" alt="enter image description here"></a></p>
  
  <p>Check this issue on my web site <a href="http://www.wholesaleunderwear.co/product/men-s-crew-sport-sock-w-logo/" rel="nofollow noreferrer"><strong>specific product page</strong></a></p>
  
  <blockquote>
    <p>So I would need to get the attribute "quantity" selected value to append the right label to the live price.</p>
  </blockquote>
  
  <p>Any help? How can I do to get that working?</p>
  
  <p>I have tried many code, and I can't get it working.</p>