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
53 4 10

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";

 

 

DK
Replies 2 (2)

Liam
Community Manager
3106 339 870

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
53 4 10

Okay, gotcha.

 

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

DK