Filter product.collections array before pagination

New Member
3 0 0

I would like to output all the products except ones with a certain tag. I can do this by using a conditional statement within the for each like so:

{% for product in collection.products %}
{%- assign not_custom_bike_product = true -%}
{% for tag in product.tags %}
      	{% if tag contains 'Accessories' %}     
      		{%- assign not_custom_bike_product = false -%}
        {% endif %}      	
{% endfor %}

{% if not_custom_bike_product %} 
{{ product.title }}
{% endif %} 
{% endfor %}

However, this seems to mess up when the paginate is set at the top as they disappear from the list.
It is almost like I need to filter the collection.products array before the pagination how do I do this I know you can filter arrays in liquid but I need to filter out if a product contains a certain tag?