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

Popular posts from this blog

OpenCV OpenCL: Convert Mat to Bitmap in JNI Layer for Android -

android - org.xmlpull.v1.XmlPullParserException: expected: START_TAG {http://schemas.xmlsoap.org/soap/envelope/}Envelope -

python - How to remove the Xframe Options header in django? -