Unable to access shop metafield data on checkout ui extension

Unable to access shop metafield data on checkout ui extension

singh2001
Shopify Partner
2 0 0

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"
Replies 2 (2)

Small_Task_Help
Shopify Partner
1121 53 111

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

To Get Shopify Experts Help, Click Here or E-mail - hi@ecommercesmalltask.com
About Us - We are Shopify Developers India
At Google My Business - Ecommerce Small Task - Hire Shopify Developers Ahmedabad
singh2001
Shopify Partner
2 0 0

Thanks for the help but its dynamic data.