Unable to access shop metafield data on checkout ui extension

I am unable to access the shop metafield data that I have stored with a specific namespace and key, on the thankyou-page. I am able to get the data using the metafield namespace and key on the graphql admin ui, but when I try to access it on the extension, I get an empty array.

I have tried almost all the visible ways to access the data, some of them include:

const metafields = useAppMetafields({namespace:“checkout_pro”, key:“form_builder”, type:“shop”});
const testMetafields = useMetafields({namespace:“checkout_pro”, key:“form_builder”})
const metafields = useAppMetafields()

I am able to access the settings data from the customiser using useSettings() hook, and also the customer data, but not the metafield values that I am passing.

This is my extension.toml setup:

[[extensions.metafields]]
namespace = “checkout_pro”
key = “form_builder”
owner_type= “SHOP”

Hi,

Hope this will work

  • Two Practical Ways to Get Your Metafield, Expose Data via useSettings()

If your metafield is something static (like config), just add it to your extension settings and access it like this:

Code Example

# extension.toml
[settings]
form_builder_config = "Your default data or JSON"

[[extensions.metafields]]
namespace = "checkout_pro"
key = "form_builder"
owner_type = "SHOP"

Or Use Cart Attributes as a Hack

Thanks for the help but its dynamic data.