
Sometimes you may need to exclude specific product to appear in search result. Here I am sharing you a tricks which i got in shopify community.
So the tricks is, put a tag , for example “Special” tag in the product and that tagged product will be removed from search result. Here i am sharing the code
{% for item in search.results %}
{% assign hidden_tag = false %}
{% for tag in item.tags %}
{% if tag == 'special' %}
{% assign hidden_tag = true %}
{% endif %}
{% endfor %}
{% if hidden_tag == true %}
{% comment %}
If it contains the tag, do this
{% endcomment %}
{% else %}
{% comment %}
If it doesn't contain the tag, do this
{% endcomment %}
{% endfor %}