title: Show only relevant tags on a WooCommerce product category page
body: <p>We've created a custom function to show all product tags on a product category page. The idea behind these tags are, that people can 'enable' and 'disable' them to show results.</p>
  <p>The problem we're facing right now, is that all the tags of the webshop are showing, instead of the relevant options that could be enabled.</p>
  <p>To give an example, on the category page &quot;Baby &amp; Peuter&quot;, you can see the tags above the product grid : <a href="https://cadeaumatch.nl/product-categorie/baby-peuter/" rel="nofollow noreferrer">https://cadeaumatch.nl/product-categorie/baby-peuter/</a></p>
  <p>When you 'enable' the tag &quot;Altijd goed&quot; (by clicking on the plus icon), there wont be any results because this tag isn't relevant for this category page.</p>
  <p>This is our current code to show the tags :</p>
  <pre><code>$cat_args     = array(
  'orderby' =&gt; 'name',
  'order' =&gt; 'asc',
  'hide_empty' =&gt; false
  );
  $product_tags = get_terms('product_tag', $cat_args);
  
  foreach ($product_tags as $tagg =&gt; $tagval) {
      if (in_array($tagval-&gt;slug, $excludedTags)) {
          foreach ($excludedTags as $key =&gt; $excludedTag) {
              if ($tagval-&gt;slug === $excludedTag) {
              
          }
      }
  } else if (in_array($tagval-&gt;slug, $includedtags)) {
      foreach ($includedtags as $key1 =&gt; $includedTag) {
          if ($tagval-&gt;slug === $includedTag) {
              
          }
      }
  } else {
      echo '&lt;span class=&quot;spanTags&quot; id=&quot;' . $tagval-&gt;slug . '&quot;  style=&quot;background-color: #f1f2f6; color:black;&quot;&gt;&lt;span  onClick=&quot;selectChangeIn(\'' . $tagval-&gt;slug . '\')&quot;&gt;&lt;i class=&quot;fas fa-plus&quot; style=&quot;color:green&quot;&gt;&lt;/i&gt;&lt;/span&gt;  &lt;a href=&quot;' . get_term_link($tagval, 'product_tag') . '&quot; style=&quot;color:black&quot;&gt;' . $tagval-&gt;name . '&lt;/a&gt; &lt;span  onClick=&quot;selectChange(\'' . $tagval-&gt;slug . '\')&quot;&gt;&lt;i class=&quot;fas fa-minus&quot; style=&quot;color:red&quot;&gt;&lt;/i&gt;&lt;/span&gt;&lt;/span&gt;';
      
  }
  };
  </code></pre>
  <p>Is there anyway to customize this code, to only show relevant tags on the category page? So that a visitor can't see tags that won't work on that specific category.</p>
  <p>Thanks in advance!</p>