Search Commerce Products by Tags this is my first Craft CMS &amp; Commerce build and I need some help with searching products by a tag field.

I have a tag field ("designTag") for each product and I would like to have a search bar that will only query the tag field for a specific product type ("designMedia") and return those products with matching or similar tag titles and also account for pagination. I can't seem to get it to work. Any help would be appreciated.


SEARCH FORM CODE:

&lt;form action="{{ url('design/keywords') }}"&gt;
    &lt;label&gt;Search By Keywords&lt;/label&gt;
    &lt;div class="append-icon"&gt;
        &lt;input type="search" name="q" class="form-control input-lg" placeholder="Enter Keyword..."&gt;
        &lt;button class="btn" type="submit"&gt;&lt;i class="nc-icon-outline ui-1_zoom"&gt;&lt;/i&gt;&lt;/button&gt;
    &lt;/div&gt;
&lt;/form&gt;


RESULTS CODE:

{% set tagTitle = craft.request.getParam('q') %}
{% set tag = craft.tags.title(tagTitle) %}    
{% set product = craft.commerce.products.search(query).order('score') %}

{% if product|length %}

{% paginate craft.commerce.products.type('designMedia').limit(48) as mediaProducts %}

{% for product in mediaProducts %}    
       &lt;div class="item"&gt;
          &lt;div class="item-wrapper"&gt;
            &lt;figure class="he-3 cyan"&gt;
              &lt;img src="{{ product.presentationSlides.first().getUrl('mediaDetail') }}" alt="{{ product.name }}"&gt;
              &lt;div class="hover-icons"&gt;
                &lt;div class="hover-icons-wrapper"&gt;
                  &lt;a href="{{ product.presentationSlides.first().getUrl('mediaLightbox') }}" class="magnific hidden-xs-down"&gt;
                    &lt;i class="nc-icon-outline ui-1_zoom"&gt;&lt;/i&gt;
                  &lt;/a&gt;
                  &lt;a href="{{ product.url }}"&gt;
                    &lt;i class="nc-icon-outline ui-2_link-71"&gt;&lt;/i&gt;
                  &lt;/a&gt;
                  &lt;a href="#" class="hidden-xs-down"&gt;
                    &lt;i class="nc-icon-outline ui-2_favourite-28"&gt;&lt;/i&gt;
                  &lt;/a&gt;
                &lt;/div&gt;
              &lt;/div&gt;
            &lt;/figure&gt;
          &lt;/div&gt;
        &lt;/div&gt;
{% endfor %}
{% else %}
    &lt;p&gt;No Results&lt;/p&gt;  
{% endif %}

/*pagination code */
{% endpaginate %}
This should work (set the limit to whatever you want/need):

{% set tag = craft.tags.title(tagTitle).first() %}    

{% paginate craft.commerce.products.relatedTo(tag).limit(10) as pageInfo, products %}

    {% for product in products %}

        {{ product.title }} etc

    {% endfor %}

    {% if pageInfo.prevUrl %}&lt;a href="{{ pageInfo.prevUrl }}"&gt;Previous Page&lt;/a&gt;{% endif %}
    {% if pageInfo.nextUrl %}&lt;a href="{{ pageInfo.nextUrl }}"&gt;Next Page&lt;/a&gt;{% endif %}


For more on the pagination side of things, see: https://craftcms.com/docs/templating/paginate