How to access App-data metafields from checkout ui extension.

Topic summary

Accessing App‑data metafields (AppInstallation‑scoped, e.g., $app namespace) from a Checkout UI extension does not work. Attempts via useExtensionApi().appMetafields or useAppMetafields and declaring [[extensions.metafields]] in shopify.extension.toml return undefined/empty.

Key findings:

  • The “AppMetafields” hook is misleadingly named; it surfaces metafields for Shop/Customer/Product/Variant relevant to checkout, not AppInstallation app‑data.
  • Multiple developers confirmed they could not read App‑data in checkout and switched to Shop‑scoped metafields instead.

Workarounds and setup:

  • Store config in Shop metafields (ownerId = shop.id), whitelist with [[extensions.metafields]] in the extension TOML, then read via useAppMetafields() and filter by namespace/key.
  • Use Admin GraphQL metafieldsSet to set values; metafieldDefinitionCreate only creates the definition and does not set data. Verify values in Admin → Settings → Custom data → Shop.

Reserved namespaces/protection:

  • Using $app or leaving namespace blank (defaults to $app) makes data unreadable in checkout.
  • Attempts to set access controls or use reserved namespace for $app returned errors (“Setting access controls on a definition under this namespace is not permitted”).

Status: No confirmed way to read AppInstallation app‑data in checkout. Open question remains on securing Shop metafields (e.g., reserved prefixes) for use across app and checkout.

Summarized with AI on December 14. AI used: gpt-5.

@DavidT Never tried. So you need to have access to the same global metafields from your app, checkout ui extension and Storefront API? Let me know if you find a solution for it.