App owned metaobjects on customer ui extensions

I have metaobjects in Shopify and I want to fetch on a full page customer UI extension only the metaobject entries of this customer. And because this is private data, I do not want to make it PUBLIC_READ, but customer read, but I couldn’t figure out how to achieve this.

I am able to fetch the references to the metaobjects, which are saved in a customer metafield, but this does not help.

query preferences($key: String!, $namespace: String!) {
                    customer {
                    id
                      metafield(namespace: $namespace, key: $key) {
                        value
                      }
                    }
                  }

Returns:

{
    "customer": {
        "id": "gid://shopify/Customer/5634857697489",
        "metafield": {
            "value": "[\"gid://shopify/Metaobject/36717691089\",\"gid://shopify/Metaobject/36731912401\",\"gid://shopify/Metaobject/36731945169\"]"
        }
    }
}

I need to fetch customers metaobjects somehow, but via customer API and not storefront API because I have access storefront: “NONE” in the metaobject definition.

Metaobjects are not exposed currently in the Customer Account API unfortunately, so they are not directly available to UI extensions.

1 Like

Argh, had a nice idea for my app, but thanks for the clarification @Mathieu

1 Like