App namespace metafield in checkout ui extension

Topic summary

Developers are encountering issues accessing app-owned customer metafields in Shopify checkout UI extensions. The metafields return empty arrays or null values despite being properly configured and accessible via Liquid code and API calls.

Configuration attempts include:

  • Setting namespace as $app:testapp or $app:configuration in shopify.extension.toml
  • Using useAppMetafields() and useApi() hooks
  • Implementing subscription patterns with appMetafields.subscribe()

Key observations:

  • Standard (non-app-owned) metafields work correctly
  • Metafields are visible in Liquid templates and API responses
  • Console logs show metafields exist but return empty when accessed in extensions
  • Proper scopes and namespace/key matching are confirmed

Current status:
No definitive solution has been found. One developer resorted to using simple settings as a workaround. A GitHub issue reference was shared suggesting a subscription-based approach, but subsequent attempts still yield null results. The discussion remains open with multiple developers seeking guidance.

Summarized with AI on October 29. AI used: claude-sonnet-4-5-20250929.

Hi!

Didnt find an aswer to this problem in exisitng threads, probably someone can help me with it.

I have a checkout ui extension where I wanted to access the app owned customer metafield (create from app with namespace: $app:testapp and name: testmeta and it is under customer objects). I was trying to put this inside cunfiguration:

 [[extensions.metafields]]
 namespace = "$app:testapp"
 key = "testmeta"

Then tried to access it:

const metafields = useAppMetafields();

And in the hook, I logged it:

   useEffect(() => {
    console.log(metafields);
  }, [metafields]);

This gives empty array. The customer is logged into the account so this is definitely not the reason. Also this way works fine if the metafield is standard (not the app owned)

Thank you!

2 Likes

Did you solve this yet, I am currently getting empty array as well

Facing same issue, Metafield showing on api.appMetafields on console but when I try to get, it’s blank ()

did you find the way how to resolve it? Please guide me on how to resolve this issue.

Unfortunately no, I endup using simple settings to make setup for the Checkout UI extension, which is rather weak solution, but still interested of course

[[extensions.metafields]]
namespace = “$app:configuration”
key = “products”
type = “json_string”

and in the checkout UI extension

const {appMetafields} = useApi();

appMetafields.subscribe((metafields) => {
console.log(‘metafields’, metafields);
});

Credit: https://github.com/Shopify/ui-extensions/issues/1621#issuecomment-1879319059

Hi @Iliasshad

Hi everyone,

I’m running into an issue with my Shopify app’s Checkout UI Extension. I’ve successfully implemented and saved app-owned metafields. When I test the metafields in Liquid code, they render correctly and return the expected values.

However, when I try to access the same metafields using app.metafields in my Checkout UI Extension, the app object is null.

I’ve already confirmed:

  • The metafields are properly set and visible in Liquid.

  • The extension has the correct metafields access scopes defined in shopify.extension.toml.

  • The metafield namespace and key match exactly.

Has anyone faced a similar issue? Is there anything specific I need to do to make app.metafields accessible inside a Checkout UI Extension?

Any help or guidance would be really appreciated!

Thanks in advance!

const { appMetafields, lines } = useApi();
useMemo(() => {
return appMetafields.subscribe((metafields) => {
console.log(metafields);
});
}, [appMetafields]);

did you try this code ?

1 Like

@Iliasshad Thanks a lot for all the support and guidance so far — I really appreciate the help from this awesome community!

I’m almost there, but I’m still running into an issue where the result is coming back as null. I’m double-checking my query and data sources, but not seeing anything obvious yet.

Code main.jsx

const { appMetafields, lines } = useApi()
    useMemo(() => {
        return appMetafields.subscribe((metafields) => {
            console.log('metafields', metafields)
        })
    }, [appMetafields])

result

If anyone has ideas on what could be causing the null response, I’d love a nudge in the right direction!