Solved

Shopify search metafields value

tinooze
Excursionist
15 1 11

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)

Jason
Shopify Expert
11190 225 2282

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 18 (18)

Jason
Shopify Expert
11190 225 2282

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
15 1 11

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
Visitor
2 0 17

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

 

Coder71
Shopify Partner
17 0 1

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
iPedro
Excursionist
16 0 19

Has this since changed? I spent considerable time implementing Metafields on our site, only to discover that they weren't searchable. This sounds like a pretty big oversight on Shopify's part. Has anyone heard whether this is on the roadmap?

AyrKenDor
Visitor
2 0 17
No change that we know of. We added all important data that we wanted searchable to the tags.

Not sure why this was automatically part of the meta fields implementation. Crazy to have data on a website in 2022 that isn’t searchable
Conscious-Power
Visitor
1 0 1

Jason - has Shopify exposed metafields to search yet? Is it on the roadmap?

iPedro
Excursionist
16 0 19

I've been to find Metafield content using our search bar. It may have been related to installing the Search & Discovery app. We've also upgraded to Shopify Plus. Or it could've been the recent Spring update. If anyone would like to test this and update the thread, I think it could be useful for others.

rachelchristina
Visitor
1 0 0

Any update on this? Feels like this such be a native feature.

AzureMinion
Shopify Partner
28 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.

renard-roux
Tourist
11 0 11

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.

CalebV
Shopify Partner
15 0 3

Thank you for this. Just like you said, what is the point of using metafields if you have to resort to hacking a default method just to make it work. I think I'm going to try this.

cfc_webmaster
Explorer
47 0 104

I was horrified to learn this today as well. lol. I had always assumed that under "more filters" there was a way to search by custom metafields. nope. 

 

For all of the Shopify greatness there is an equal amount of absurd shortcomings. I would say 65% of the "apps" out there propose to "fix" things that should be standard features with any shopify store. filtering by multiple tags, searching by metafield, or simple stuff like BULK updates for URLs. We need a way to vote for features

 

This is a public company now. I own 5 shares of NYSE:SHOP. Not a big player, lol, just a little fry with a Robbinhood account. I have an idea: LETS GET A GROUP TOGATHER OF SHOPIFY USERS WHO ALL HAVE AT LEAST 1 SHARE OF NYSE:SHOP STOCK and then write letters to the investor relations department, they are required by law by the SEC to read written letters from shareholders. This could be a way to show our support (clearly we use the product and own stock, so we are all "part owners") while making sure our voice is being heard.

fedstreetbooks
Excursionist
17 0 19

I'm just chiming in to say that it seems crazy not to have metafield data available in search, given that we can insert those fields to appear on the site itself. In the case of my business, I finally have book authors available as a metafield upon import, but that is utterly useless to me if people cannot search them, and I have too many unique SKUs and authors to apply any of the workarounds mentioned here. Nor do I have the money for an expensive "enhanced search" app. Shopify, please fix this.

ctwork3120
Excursionist
24 0 24

Agree they really need to solve this 

CHN2222
Tourist
9 0 2

I fully agree. Metafield data should  be available in search. This feature is really needed.

mechaadi
Shopify Partner
1 0 0

A little late to the party, but you can search for products using their meta fields via the storefront graphql API, here's an example:

query Products {
    products(first: 1, query: "metafield:value:<metafield_value>") {
        edges {
            cursor
            node {
                description
                handle
                id
                title
                metafield(key: "<metafield_key>", namespace: "custom") {
                    key
                    namespace
                    value
                }
            }
        }
    }
}

 

mechaadi
Lin_RelationsJP
Excursionist
12 0 1

Hi Mechaadi,

 

Where should we put these codes?

Is it possible to search the variants metafields?

(customer site)

We managed to display it at the storefront but were not able to search.

e.g.  varaints.metafields.custom.color