Why won't liquid code hide items from search?

Hey Guys,

I’m trying to hide the product type “NEON_CUSTOMIZED_PRODUCT” from my search. Having no luck.

This is the line I’m using on main-search.liquid with the impact theme:

{%- if item.type == ‘NEON_CUSTOMIZED_PRODUCT’ -%}{%- continue -%}{%- endif -%}

Any ideas why it doesn’t work?

it’s placed under two places where it says

{% for item in search.results %}

Many thanks!

Hi @NeonDaddy ,

I have checked the code and it works fine, can you double check the type, the value ‘NEON_CUSTOMIZED_PRODUCT’ is correct, or is it ‘NEON CUSTOMIZED PRODUCT’.

Or you can use unless to catch display instead of continue:

{%- unless item.type == 'NEON_CUSTOMIZED_PRODUCT' -%}
   
%- endunless -%}

Hope it helps!

Thank you, did did try it as:

{%- if item.type == ‘Neon Customized Product’ -%}{%- continue -%}{%- endif -%}

Yesterday but didn’t work. I must’ve made a mistake somewhere as I just tried again and it works!!

Thanks so much for your help. Really appreciate it :slightly_smiling_face:

1 Like