Query product inside collection with metafield value

Solved

Query product inside collection with metafield value

Stelikas
Shopify Partner
11 3 0

I'm trying to query a product based on a metafield value through a collection since this is the only possible way at the moment: 

 

I have written the query below: 

 

  query Collection {
    collection(id: "gid://shopify/Collection/429854163254") {
      handle
      products(first: 30, 
				filters: {
					productMetafield: {
						namespace: "mangento", 
						key: "ceid", 
						value: "Round"}
				}) {
        edges {
          node {
            handle
            title
          }
        }
      }
    }
  }

 

 

And it returns this error: 

Field 'products' doesn't accept argument 'filters'

I have enabled Search & Discovery app, as i read somewhere that it is required but the error still appears. 

Honestly the documentation is quiet confusing for such simple things, a little help would be amazingly appreciated. 

 

Thanks and regards.

 

 

 

 

Accepted Solution (1)

Stelikas
Shopify Partner
11 3 0

This is an accepted solution.

Changing endpoint to: https://{{ store }}.myshopify.com/api/{{api_version}}/graphql.json 

From: https://{{ store }}.myshopify.com/admin/api/graphql.json 

 

Made it work.

View solution in original post

Replies 3 (3)

Stelikas
Shopify Partner
11 3 0

This is an accepted solution.

Changing endpoint to: https://{{ store }}.myshopify.com/api/{{api_version}}/graphql.json 

From: https://{{ store }}.myshopify.com/admin/api/graphql.json 

 

Made it work.

CalebV
Shopify Partner
15 0 4

Does anyone know if this will ever be an option to perform that search through the Admin API?

ZILIO
Shopify Partner
3 0 0

Yeah seems crazy this isn't available in the Admin API... 😫