Query by metafield value
It's possible to query Shopify resources by metafield value. This is useful if you want to find all products or metaobjects that have a metafield with a specific value.
To query by metafield value, first the metafield you want to query by must have filtering enabled.
Filtering can also be enabled in the Shopify admin. Learn more about enabling filtering for product metafields and filtering for metaobject fields.
Available metafield types include:
- Single line text or Single line text (list)
- Product reference or Product reference (list)
- True or false
- Collection reference or Collection reference (list)
- Page reference or Page reference (list)
- Metaobject reference or Metaobject reference (list)
- Company reference or Company reference (list)
Only case-sensitive, exact matches are supported for filtering.
Anchor to Querying metaobjects by field valueQuerying metaobjects by field value
Anchor to Querying metaobjects by taxonomy reference field valueQuerying metaobjects by taxonomy reference field value
POST https://{shop}.myshopify.com/api/{api_version}/graphql.json
GraphQL mutation
This example uses the GID structure for the taxonomy node for the color
blue. You can find GIDs for taxonomy nodes in the open source Taxonomy Explorer.
Anchor to Querying metaobjects using a simple single line text fieldQuerying metaobjects using a simple single line text field
POST https://{shop}.myshopify.com/api/{api_version}/graphql.json
GraphQL mutation
The syntax for querying fields on metaobjects is fields.{key}:{query_value}
.
Anchor to Querying products by field valueQuerying products by field value
POST https://{shop}.myshopify.com/api/{api_version}/graphql.json
GraphQL mutation
The syntax for metafields on core resources (such as products) is metafields.{namespace}.{key}:{query_value}
.