Shopify themes, liquid, logos, and UX
I have found this code:
{% assign filtered_results = search.results | where_exp: "product", "product.tags contains 'exclude-from-search' == false" %}
I have tagged all the products that I do not want displayed in search results with "exclude-from-search".
I thought that this code should go in: main-search.liquid
But I can't figure out where to put it. Nothing has worked so far.
Hi I think I can help with that. If you're still having issues, feel free to share more details.
Hello @modernmagic ,
The code will be used with the existing loop.
Check the search template for similar loop
starts with
{% for item in search.results %}
and ends with
{% endfor %}
now here you have to apply the logic.
Regards
Guleria
Hello @modernmagic
Welcome to the Shopify Community! Please share your store URL and password (if it’s password-protected), so I can check and provide you with the exact solution.
Hi, @modernmagic
Look for a loop like:
{% for item in search.results %}
Replace it with:
{% assign filtered_products = search.results | where: "object_type", "product" %}
{% assign visible_products = filtered_products | reject: "tags", "exclude-from-search" %}
{% for product in visible_products %}
<!-- Render product card -->
{% render 'card-product', product: product %}
{% endfor %}
If you will unable to implement the same then I'm happy to do this for you, let me know.
Hope this helps! If yes then Please don't forget hit Like and Mark it as solution!
June brought summer energy to our community. Members jumped in with solutions, clicked ...
By JasonH Jun 5, 2025Learn how to build powerful custom workflows in Shopify Flow with expert guidance from ...
By Jacqui May 7, 2025Did You Know? May is named after Maia, the Roman goddess of growth and flourishing! ...
By JasonH May 2, 2025