Can you search for customer using metafields?

turqay16
Shopify Partner
1 0 0

I have distributors and customers and they are linked used metafields, basically a customer has a metafield of distributorId, and I used to it to create a 1 to many relation, but how can i look it up?

Reply 1 (1)

richard-penner
Shopify Staff
19 2 6

Hi @turqay16 –

Metafields are meant to store additional information about Shopify resources, so you can easily fetch metafield values in your case when fetching the Customers via API. But there is currently no way to do a "lookup by value", e.g. fetch all Customers where DistributorId = 123. You may need to use your own application logic / database for this reverse lookup.

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