Make metafields searchable for predictive search results

Hey,

I have a meta field containing a unique style name for each product. When a user enters that name in the search bar and presses enter, the respective product appears. I made that possible by adding a tag containing the style name to each product.

However, when you start to type the style name in the search bar and don’t press “enter”, hence wait for the predictive search results, it shows no results, i.e. says that nothing can be found.

How can I make that specific meta field also searchable for the predictive search results and make the search bar show results before someone presses enter?

I am using the BeYours Theme by RoarTheme.

Any help is appreciated.

Hi @breaddddd metafields are not properties used in the predictive search api

https://shopify.dev/docs/api/ajax/reference/predictive-search#searchable-properties

Either copy such values to tags , to automate this use shopify-flow or usemechanic app.

https://tasks.mechanic.dev/?tags=Metafields%2CTag

Otherwise use a dedicated search app or service for this.

Hey Paul,

thank you for your reply.

Is there no way to code it into the theme code? I found this article: https://community.shopify.com/c/shopify-design/need-some-help-with-metafields-in-search-and-a-theme-code/m-p/2537819

They showed how this could be achieved by editing the code, but somehow it does not work for me. I am not sure whether I need to adapt the code snipped and if so, to what?

Thanks again!