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.

Trying to create a metafield definition for a namespace/key after metafields already exist

Trying to create a metafield definition for a namespace/key after metafields already exist

jne
Shopify Partner
8 0 12

I'm trying to create a metafield definition on PRODUCT owner type using GraphQL API, but there are existing metafield values for the namespace/key I'm using.

 

When I use metafieldDefinitionCreate, I end up with the error "Namespace and key is already in use for a set of your metafields".

 

I know it can be done in the Shopify Admin UI by picking "Metafields without a definition" and then adding one, but is there any way to do it with the API?

 

 

Replies 9 (9)

M-Gamal
Shopify Partner
1 0 1

Same Problem Here,

I can't understand why it is forbidden through the API but Permitted through the Admin Dashboard.
It should have the same behavior through both channels.


Could someone from Shopify Stuff inlight us with the purpose of the different behavior?

M. Gamal

SterlingHirsh
Visitor
1 0 0

I'm also having this problem. I have seen there's a forceCreate option that gets passed in the admin web UI, but it doesn't accept it from GraphQL.

Vlad_BWT
Shopify Partner
2 0 1

Hello!

Also have the same problem with metafieldDefinitionCreate mutation in Admin GraphQL API.

dgtlmonk
Shopify Partner
38 3 8

Any update on this ?

CharlyTalavera
Shopify Partner
31 1 9

Is there any update about this?

We need a solution so if there are Metafields created, be able to create Metafield Definitions on top of that anyway. Otherwise we have existing Metafields on some shops that we can't reuse and display on the UI.

murphy-anker
Shopify Partner
1 0 0

Any update on this

BCSE
Shopify Partner
2 0 0

Hi,

Yes, we have the same problem here.

PlusApps
Shopify Partner
20 0 7

Any update? Shopify is getting painful for the dev day by day..

CharlyTalavera
Shopify Partner
31 1 9

Hi everyone!

This week we retried this behavior, and looks like now it's working as expected.

So, if you have metafields with some namespace/key, you can create a Metafield Definition afterward without any issue.

I hope this behavior now works as everyone expected. 💫