GraphQL - How to query the shop pages by metafields

blackandred
Visitor
1 0 0

Using GraphQL, I can't seem to find a solution to query specific shop pages by metafields.

 

Use case:

 

We added a few metafields to the Online Store -> Pages. An example of a custom field is "Page Type", which can be one of three selections.

 

Is it currently possible to run a graphql query and only return results that match the metafield conditions?

 

Example: select * from shopPages where pageType = category.

 

I know we're not using SQL, but just want to show the type of graphql query we're trying to accomplish.

 

Thanks,

Reply 1 (1)

Josh
Shopify Staff
1134 84 233

Hello @blackandred , 

 

At this time, it isn't possible to query pages based on metafield via the Storefront or Admin APIs. Querying pages in the Admin API in general appears to be lacking quite a bit of functionality actually, if I'm being honest - but the Storefront API also only allows for querying pages based on either created_at, updated_at, title, or handle. 

Josh | Shopify 
 - Was my reply helpful? Click Like to let me know! 
 - Was your question answered? Mark it as an Accepted Solution
 - To learn more visit the Shopify Help Center or the Shopify Blog