title: How can I dynamically change the price of a Product based on the amount of characters entered into a Custom Field by a Shopper?
body: <p>I am currently working on a WordPress website, with WooCommerce functionality.  On the Product Page, I have created a Custom Field, which allows shoppers to enter a piece of text that they would like to appear on the associated product.</p>
  
  <p>Each product has a starting price with my client wanting to then charge the shopper an additional fee of (for example) £1 per letter entered into the Custom Field.</p>
  
  <p>My client would then like the Product Price, on the Product Page, to change in real time to reflect the amount of letters entered.  For example:</p>
  
  <blockquote>
    <p>Product A:  £20</p>
    
    <p>As shopper enters 5 letters, the Product Price changes to £25 in real
    time.</p>
  </blockquote>
  
  <p>So far, I have created the Character Counter on the Product Page, using the following code:</p>
  
  <p><strong>JavaScript/jQuery:</strong></p>
  
  <pre><code>&lt;script type="text/javascript"&gt; 
  jQuery(document).on('keyup', '.product-custom-text', updateCount);
  jQuery(document).on('keydown', '.product-custom-text', updateCount);
  
  function updateCount() {
      var cs = jQuery(this).val().length;
      jQuery('#character_count').text(cs);
  }
  &lt;/script&gt;
  </code></pre>
  
  <p>At present, I am Outputting this Character Counter through the use of the below code in the <code>functions.php</code> file:</p>
  
  <p><strong>Code Entered into functions.php file:</strong></p>
  
  <pre><code>function custom_character_counter(){
      echo 'Letters Entered:  &lt;span id="character_count"&gt;&lt;/span&gt;';
  }
  add_action('woocommerce_single_product_summary', 'custom_character_counter');
  </code></pre>
  
  <p>I could be wrong, but I assume I now need to manipulate the product price to reflect the following equation:</p>
  
  <pre><code>Original Product Price + (Characters Entered x £1)
  </code></pre>
  
  <p>Does anyone have any idea on how I can achieve this or indeed if there is a better approach?</p>
  
  <p>Thanks in advance.</p>