liquid - How to hide products in Shopify search results based on a vendor name -
i'm in situation hiding vendors products in control panel isn't options due outside pos. test in search.liquid, used search.terms below. code works not type thevendor same way , see products if don't type thevendor.
{% item in search.results %} {% if search.terms == 'thevendor' %} {% else %} {% include 'search-result' %} {% endif %} {% endfor %}
i tried figure out how write code hide these products in better way. tried product.vendor below when search products individually not hidden. code:
{% item in search.results %} {% if product.vendor == 'thevendor' %} {% else %} {% include 'search-result' %} {% endif %} {% endfor %}
can tell me i'm missing here? seems doesn't know product.vendor when print out vendor is, displays vendor. don't understand why it's not hiding products associated vendor.
{% item in search.results %} {% if item.product.vendor == 'thevendor' %} {% else %} {% include 'search-result' %} {% endif %} {% endfor %}
this should work.
Comments
Post a Comment