JS Buy SDK: Updated Storefront Schema (Metafields)

Hello!

As stated in #671 on GitHub, there was a Schema Bump and now Metafields should be available (rgd 2.2.4).

No matter what I try, I get no Metafields for my Product.

No field of name “metafield” found on type “Product” in schema, or “No Metafield” as in Schema…

I am using js-buy-sdk 2.5.0.

I can’t find any documentation on Metafields, besides the API Spec, which says Metafields is implemented on Node.
I can’t add(‘hasMetafield’) on Product → No field on type Product.

    const productsQuery = client.graphQLClient.query((root) => {
      root.addConnection('products',{args: {first: 10}}, (product) => {
        product.add('id')
        // product.add('metafield', (metafield) => {
        //   metafield.add('id')
        // })
        // product.addConnection('metafields', {args: {namespace: 'prod'}}, (meta) => {
        //   meta.add('key')
        // });
      });
    });

Please send me some help! :wink:

Best regards, Philipp

As stated on the Metafield API Guides:
“By default, the Storefront API can’t read metafields. To expose specific metafields to the Storefront API, you need to use the GraphQL Admin API to whitelist them.”

So I’m going to discard the js-buy-sdk implementation and use ApolloClient with full Auth and GraphQL Admin API.

IMHO this shouldn’t be necessary for some Metafields.