title: How do I make a WordPress Woocommerce PHP function apply to a specific selection of Product IDs
body: <p><strong>What I am trying to achieve:</strong><br>
  To add a custom redirect button, but only for specific product pages:
  <a href="https://i.stack.imgur.com/Arn4c.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/Arn4c.png" alt="enter image description here"></a><br><br>
  <strong>What I have done to achieve this so far:</strong><br>
  Have added a new custom field within the wordpress 'Custom Fields' section within the 'TEST 1' and 'TEST 2' products I am using, which is set to redirect to my test site's Cookies page for the purposes of this test:<br>
  <a href="https://i.stack.imgur.com/GyuXW.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/GyuXW.png" alt="custom fields"></a><br><br>
  <strong>The PHP I am using right now:</strong><br></p>
  
  <pre><code>/** WooCommerce custom field - 'No Thanks' Button **/
  add_action('woocommerce_after_add_to_cart_button','nothanks_redirect_button');
  function nothanks_redirect_button() {
      $productID = get_the_ID($productID,'12682, 12686');
      $yourCustomLinkValue =  get_post_meta($productID,'nothanks_link_redirect_meta',true);
      echo '&lt;a class="button" style="margin: 0 0 0 20px" href="'.$yourCustomLinkValue.'" target="_self"&gt;No Thanks&lt;/a&gt;';    
  }
  </code></pre>
  
  <p><br>
  <strong>The problem:</strong><br>
  The function is applying itself to all products globally, but I want it to apply only to the multiple Product IDs I declare (ie. 12682 and 12686).<br>I would love to know how to make this function declare itself for specific product category IDs too if possible.<br>I would highly appreciate it if someone could set me straight with where I'm missing the trick. Thank you </p>