Shopify search metafields value

Solved
tinooze
Excursionist
13 1 3

Hi,

My store has 5 metafields. All of which have been displayed on the storefront.

But the native search from Shopify can only result in the product title / description, collection or articles.

These metafields include valuable data, is there a way to enable search bar to include those data as well?

Thank you.

Accepted Solution (1)

Accepted Solutions
Jason
Shopify Expert
10882 190 2178

This is an accepted solution.

No. At this point in time Shopify hasn’t exposed metafields to search but there are some search apps that will help.

Now if you have a very small product range you could create your own search tool with Liquid and JavaScript where you loop over all products (let’s say less than 50),check the metafields on each, and then show any that match.

★ I jump on these forums in my free time to help and share some insights. Not looking to be hired, and not looking for work. http://freakdesign.com.au ★

View solution in original post

Replies 6 (6)
Jason
Shopify Expert
10882 190 2178

This is an accepted solution.

No. At this point in time Shopify hasn’t exposed metafields to search but there are some search apps that will help.

Now if you have a very small product range you could create your own search tool with Liquid and JavaScript where you loop over all products (let’s say less than 50),check the metafields on each, and then show any that match.

★ I jump on these forums in my free time to help and share some insights. Not looking to be hired, and not looking for work. http://freakdesign.com.au ★
tinooze
Excursionist
13 1 3

Yes, I'm kinda aware of the situation.

It's hard waiting for a big platform to go around hoops.

But thank you for not recommending another search app and keep the community focus on solely discussion.

AyrKenDor
New Member
1 0 0

Hi,

 

Just wondering if there is any indication of when Shopify will expose metafields to search? 

 

Having entered a lot of data into metafields only to find out that we have to either re-enter it as tags (doing something twice is never efficient or wise) or use/pay for an add-on app that doesn't look/feel interact like the rest of the paid theme doesn't sit well at all.

 

I appreciate the scale of the data could be intense but for many storefronts, the data in the metafields is the same amount of data that was previously in the product description or other descriptions (that were 100% searchable).

 

Launching 2.0 with 'improved' functionality including metafields that aren't searchable seems naïve and very short sighted on Shopify's part.  Why would a storefront go to the work of entering data into their store only to have it not be searchable?

 

Had there been a disclaimer that metafields weren't searchable, we wouldn't have spent weeks migrating to a new theme. We found the issue as a fluke after tons of work had been done.  Really disappointing and frustrating.  It has completed halted our launch plans.

 

thx

 

AzureMinion
Tourist
22 0 0

You can use this app https://apps.shopify.com/ultimate-search-and-filter-1 to enable search by metafields. Once installed, go to the app, App settings => Search index and add your product or variant metafields then hit Sync.

Coder71
Shopify Partner
4 0 0

Hello Jason.

 

Currently, Shopify added the Metafields system on Settings.

 

Do you know Shopify search algorithm search content from the new Metafields or not?

 

Thanks in advance.

Coder71 Team | Your Shopify Expert

- Was my reply helpful? Click Like to let me know!

- Was your question answered? Mark it as an Accepted Solution

- To learn more visit our Service Page or Website
renard-roux
Tourist
9 0 9

I found a workable solution/workaround to this situation, sortof. It might not work perfectly in your scenario, but I'll leave it here in case someone else can use it for something.

 

I have a metafield that contains keywords pertaining to the product. I loop over this list to create a link for each keyword, which is displayed at the bottom of my product description. The link takes the customer to the search results for that word. This is both for the customer and for SEO purposes, basically creating a second set of Tags I can show the user, without exposing all the regular/system Tags I use to do internal stuff like sorting posters based on language, dimensions, orientation, etc.

 

As an example, see the 'KEYWORDS' section in the product description for this alphabet/letter poster in my shop: https://rouxposter.com/products/the-letter-n-a-poster-with-english-n-words

Click on any word in the list, and you'll see that the search results find at least one poster (I haven't implemented the keywords on all my posters yet).

 

As the keywords are in a metafield, they won't trigger any search results by themselves (sadly). So what I've done is I've added the keywords to the bottom of my product description, preceded by the word 'search-split', e.g.:

 

(in the product description field)

My product description blah blah blah

search-split my, list, of, keywords, or anything else you want to be searchable but not visible.

 

In my product-template.liquid, I split the product.description in two by using 'search-split' as the splitting text. I then output the first part of the product description, effectively hiding the keywords from the user, while still letting them be part of the searchable words for this product:

 

(in product-template.liquid, when outputting the product description)

<!-- ROUX HIDE SEARCH KEYWORDS -->
{% assign hide-search = product.description | split: "search-split" %}

{{ hide-search | first }}

 

This does require you to add the keywords twice in my specific use-case (both in metafield and in product description), which probably isn't all that clever. While writing this, I realised I don't really need the metafield, I just need to create my links by looping over the second part of 'hide-search'. I ended up dropping the metafield completely and just doing this instead:

 

<!-- ROUX HIDE SEARCH KEYWORDS -->
{% assign hide-search = product.description | split: "search-split" %}

{{ hide-search | first }}


<!-- ROUX MAKE KEYWORD LINK LIST -->
{% if hide-search.size == 2 %}
{% assign keyword-list = hide-search[1]| split: ', ' %}

<h4>Keywords — click to search</h4>
{% for keyword in keyword-list %}
<a href="/search?type=product&options%5Bprefix%5D=none&q={{keyword}}&options%5Bprefix%5D=last" class="keyword-links" title="click here to search for '{{keyword}}'">{{ keyword }}</a>{% if forloop.last != true %},{% endif %}
{% endfor %}</p>
{% endif %}

 

Of course, you probably don't need the link list like me, so just skip the second part of the code.

 

In closing, I've basically made a hack for hiding specific text from the product page while keeping the hidden text searchable, which is probably not useable in most metafield-related cases. I hope someone can still use this for something. Let me know what you think.