Storefront API v. 2023-07 not querying fields on Metaobjects

Storefront API v. 2023-07 not querying fields on Metaobjects

KookiKodes
Shopify Partner
2 0 0

Hello,
I'm trying to query the storefront api version 2023-07 for a metaobject. The following is the structure of my query:

 

const query = `
      query bundleParent($id: ID!) {
        metaobject(id: $id) {
          id
          handle
          fields {
            key
          }
          parent: field(key:"bundle_parent"){
            value
            data:reference {
              ... on ProductVariant {
                id
                title
                price {
                  amount
                  currencyCode
                }
                compareAtPrice {
                  amount
                  currencyCode
                }
                size: metafield(key: "size", namespace: "bundle") {
                  value
                }
              }
            }
          }
          children: field(key:"bundle_children"){
            value
          }
        }
      }
`

 

 

I'm running this query through the ShopifyGraphiQL app with all permissions enabled and ensuring I've selected the storefront api version 2023-07

I've ensured the following checklist:

  1. The metaobject is available to Storefront API.
  2. The metaobject has the fields and data I'm trying to access.
  3. Send the associated metaobject id as a variable along with the query.

When making this query to the storefront api, it returns back the metaobject, however it does not recognize any fields associated with the metaobject. Meaning all I have access to is the id and the handle from the above query. The `parent` field returns null, the `children` field returns null and even the `fields` field returns an empty array.


Is there something I'm doing wrong here? I've tested the exact same query with some minor differences on the Graphql Admin Api and it works just fine.

Replies 4 (4)

SBD_
Shopify Staff
1829 271 415

Hey @KookiKodes 

 

Can you DM me store details please?

Scott | Developer Advocate @ Shopify 

KookiKodes
Shopify Partner
2 0 0

Hello @SBD_ !

Not entirely sure how the private messages work, but I've gone ahead and sent a message. I just can't seem to confirm on my end if it went through or not!

Yousaf2
Shopify Partner
1 0 0

Having a similar issue with shop metafields, Metaobjects fields with values are returned when using Admin API but with storefront API everything else is returned but not fields or references object.

SBD_
Shopify Staff
1829 271 415

Got it and responded 🙂

Scott | Developer Advocate @ Shopify