Shopify themes, liquid, logos, and UX
Dear All
I am trying to hide wholesale products from the search result. I tagged the product by Wholesale. I have made the following changes in red in the theme search.liquid as recommended in one of the forum posts. But instead of hiding the Wholesale product, the retail product is hidden. Any advice would be highly appreciated.
{% for item in search.results %}
{% unless product.tags contains 'Wholesale' %}
{% if item.object_type == 'product' %}
{%- assign product = item -%}
{% include 'product-grid-item' %}
{% else %}
<div class="grid__item grid-search medium-up--one-quarter medium--one-half">
<div class="grid-search__page">
<a href="{{ item.url }}" class="grid-search__page-link">
<span class="grid-search__page-content">
<span class="h4">{{ item.title }}</span>
{% if item.object_type == 'article' and item.image %}
{%- assign img_url = item.image | img_url: '1x1' | replace: '_1x1.', '_{width}x.' -%}
<img class="grid-product__image lazyload"
data-src="{{ img_url }}"
data-widths="[180, 360, 540]"
data-aspectratio="{{ item.image.aspect_ratio }}"
data-sizes="auto"
alt="{{ item.title | escape }}">
{% endif %}
{{ item.content | strip_html | truncatewords: 60 }}
</span>
</a>
</div>
</div>
{% endif %}
{% endunless %}
{% endfor %}
I've developed this app that does the job without modifying your theme code: https://apps.shopify.com/hide-from-search
Hi @Merim2020
You can add this one below the {% for item in search.results %} line
Portrait of Stephen positioned next to an image of planet Earth, with the Stephen's World ...
By JasonH Mar 18, 2024Digital marketers and app developers have tracked activity in apps and websites for yea...
By Ollie Mar 13, 2024February was an exciting month with Shopify Editions, informative webinars, and more! F...
By JasonH Mar 7, 2024