Re: 2022-07RC Storefront Changes to metafields on ProductVariant / Product queries?

2022-07RC Storefront Changes to metafields on ProductVariant / Product queries?

steveb3210
Shopify Partner
7 1 1

Is this an intended change?  Metafields can no longer be queried as a list for a product or variant?

 

Theres no mention of this in the CHANGELOG..

 

I'm now seeing this in my queries that haven't changed since a week ago...

 

 

Field 'edges' doesn't exist on type 'Metafield'

Field 'metafields' doesn't accept argument 'first'

Field 'metafields' is missing required arguments: identifiers

 

 

Replies 5 (5)

andrewrobbins
Shopify Partner
26 0 11

Yep, I'm experiencing this as well. 

 

According to the release candidate version of the API, you have to now pass a list of Identifiers. 

 

https://shopify.dev/api/storefront/2022-07/objects/Product

 

Not sure how this needs to be formatted though. I'm actually trying to adjust my graphql to make it work right now.

Creator of ShopWP https://wpshop.io
iamdeaneyelid
Shopify Partner
2 0 1

I've just ran into the same issue. Reverted to the 2022-04 storefront api for now but can't find any info on this. Have you found anything ?

iamdeaneyelid
Shopify Partner
2 0 1

Actually, just noticed that it is in the release notes

 

As of API version 2022-07, the HasMetafields.metafields paginated connection in the Storefront API is deprecated. Previously, this connection enabled you to paginate over all visible metafields in a given resource.

HasMetafields.metafields now accepts a list of metafield namespaces and keys, and returns a list of associated metafields that match the given namespaces and keys.

For more information, refer to the HasMetafields interface.

 

Celso_White
Shopify Partner
23 0 29

Also had some trouble with this. Found the format after a bit of troubleshooting.

 

metafields(identifiers: [ 
 {namespace: "your-namespace", key: "your-key"}, 
 {namespace: "your-namespace", key: "your-key"}, 
]) { 
 type 
 namespace 
 key 
 ... whichever fields you want to return 
}
mdunbavan
Visitor
1 0 0

Is this something that will work if you wanted to list out all metafields on the front-end of your site? So the idea would be that you could list out metafields and their values to be used in search functionality