How can I show a specific product when search doesn't have results?

Hi!

I would like to show a specific product in the search results, if the searched term does not give any results.
Already tried different apps, but they all weren’t able to do so.
Is it possible? Could somebody advice?

Best regards,

Gordon

Hello Gordon,

Yes it’s possible.
Use the below logic:

{%- if search.performed == false or search.results_count == 0 -%}
// Your default search code here
{%- else -%}
// Add specefic product collection loop here.
{%- endif -%}

Thanks

Thanks! This is working :slightly_smiling_face: