Re: How to filter customer query by matafields

How to filter customer query by matafields

_tim_
Shopify Partner
6 0 0

I want to get a set of customer who has a specific metafield via API

 

for example I want to query all customer that has a metafield customer.metafields.profile.age  =  20

Is it possible with REST API or GraphQL? 

In GraphQL, metafield was not in the query parameters. 

 

Thank in advance

Replies 2 (2)

BrianLegault
Shopify Staff (Retired)
2 0 0

Hi @_tim_,

Thanks for reaching out regarding this use-case about querying by Metafield values. At this time, it is not supported in REST nor in GraphQL APIs. We have taken this as feedback, as we see the value of this capability.

To learn more visit the Shopify Help Center or the Community Blog.

_tim_
Shopify Partner
6 0 0

Any other work around this? 

 

Do I have to query for all the metafields first, then loop around to fetch  all customers having that metafield?