title: Add recaptcha v2 to woocommerce product review comment before submit button
body: <p>I want to add google recaptcha v2 to woocommerce product page exactly after comment area before submit button, I found a peace of code that work fine in posts, but I can't make it work in woocommerce product review comment, this is what I have:</p>
  <p>This part goes in single.php before get_header();</p>
  <pre><code>wp_enqueue_script('google-recaptcha', 'https://www.google.com/recaptcha/api.js');
  
  </code></pre>
  <p>And this part goes in functions.php:</p>
  <pre><code>/**
   * Google recaptcha add before the submit button
   */
  function add_google_recaptcha($submit_field) {
      $submit_field['submit_field'] = '&lt;div class=&quot;g-recaptcha&quot; data-sitekey=&quot;your_site_key&quot;&gt;&lt;/div&gt;&lt;br&gt;' . $submit_field['submit_field'];
      return $submit_field;
  }
  if (!is_user_logged_in()) {
      add_filter('comment_form_defaults','add_google_recaptcha');
  }
   
  /**
   * Google recaptcha check, validate and catch the spammer
   */
  function is_valid_captcha($captcha) {
  $captcha_postdata = http_build_query(array(
                              'secret' =&gt; 'your_secret_key',
                              'response' =&gt; $captcha,
                              'remoteip' =&gt; $_SERVER['REMOTE_ADDR']));
  $captcha_opts = array('http' =&gt; array(
                        'method'  =&gt; 'POST',
                        'header'  =&gt; 'Content-type: application/x-www-form-urlencoded',
                        'content' =&gt; $captcha_postdata));
  $captcha_context  = stream_context_create($captcha_opts);
  $captcha_response = json_decode(file_get_contents(&quot;https://www.google.com/recaptcha/api/siteverify&quot; , false , $captcha_context), true);
  if ($captcha_response['success'])
      return true;
  else
      return false;
  }
   
  function verify_google_recaptcha() {
  $recaptcha = $_POST['g-recaptcha-response'];
  if (empty($recaptcha))
      wp_die( __(&quot;&lt;b&gt;ERROR:&lt;/b&gt; please select &lt;b&gt;I'm not a robot!&lt;/b&gt;&lt;p&gt;&lt;a href='javascript:history.back()'&gt;« Back&lt;/a&gt;&lt;/p&gt;&quot;));
  else if (!is_valid_captcha($recaptcha))
      wp_die( __(&quot;&lt;b&gt;Go away SPAMMER!&lt;/b&gt;&quot;));
  }
  if (!is_user_logged_in()) {
      add_action('pre_comment_on_post', 'verify_google_recaptcha');
  }
  </code></pre>
  <p>Any idea how to make it work?</p>