Our Partner & Developer boards on the community are moving to a brand new home: the .dev community forums! While you can still access past discussions here, for all your future app and storefront building questions, head over to the new forums.

How to create metafields with reserved prefixes from checkout extension React code

How to create metafields with reserved prefixes from checkout extension React code

Turbofan1178
Shopify Partner
57 4 17

I'm working on a checkout ui extension that adds extra fields to the checkout and I'm trying to use reserved prefixes to make the metafields that are created by my app unique. I don't seem to really know how to do that and I can't find any docs for it.

 

Here's what I've thus far, this doesn't work by the way

 

const FOO_METAFIELD_NAMESPACE = "$app:FOO";
const FOO_METAFIELD_KEY = "foo_key";

 

 

Founder, WC: Invite To WhatsApp Channel
- Invite customers to join your WhatsApp channel with a single click
- Boost outreach message open rates
- Grow sales with direct outreach on WhatsApp channels
Replies 2 (2)

Liam
Community Manager
3108 344 911

Hi Turbofan1178,

 

I don't think you need to include `$app` at the beginning - any metafield you app creates should automatically have your apps unique ID. Could you use the metafieldDefinitionCreate mutation for your use case?

Liam | Developer Advocate @ Shopify 
 - Was my reply helpful? Click Like to let me know! 
 - Was your question answered? Mark it as an Accepted Solution
 - To learn more visit Shopify.dev or the Shopify Web Design and Development Blog

Turbofan1178
Shopify Partner
57 4 17

Okay, gotcha.

 

However, how can I call that mutation from a checkout ui extension React code?

Founder, WC: Invite To WhatsApp Channel
- Invite customers to join your WhatsApp channel with a single click
- Boost outreach message open rates
- Grow sales with direct outreach on WhatsApp channels