Conversations about creating, managing, and using metafields to store and retrieve custom data for apps and themes.
Hi,
I am facing the an issue while force-creating an metafield definition. I have following error message:
"message": "Variable $definition of type MetafieldDefinitionInput! was provided invalid value for forceCreate (Field is not defined on MetafieldDefinitionInput)"
Can anyone please help me with it?
Hi @sratna 👋
It looks like you're using the `metafieldDefinitionCreate` mutation and running into issue with building the variable inputs. The `MetafieldDefinitionInput` fields doesn't have a `forceCreate` field in version 2022-10. Would you kindly share the version you're using and the full variables payload so that we can take a closer look? Please be sure to redact any private information!
Developer Support @ Shopify
- Was this reply helpful? Click Like to let us 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
Hi,
Thanks for the reply.
Here is my mutation:
mutation CreateMetafieldDefinition($definition: MetafieldDefinitionInput!) {
metafieldDefinitionCreate(definition: $definition) {
createdDefinition {
name
}
userErrors {
field
message
code
}
}
}
definition: {
"name": "ID",
"namespace": "test",
"key": "id",
"description": "ID",
"type": "single_line_text_field",
"ownerType": "PRODUCT",
"forceCreate": true,
}
Not sure which shopify-admin-graphql version I am using. I am using graphql client from `@Shopify/shopify-api -
Hi @ShopifyDevSup currently we're on version 2023-07 and looks like the `forceCreate` field still not available on the API.
Do you know if there is any other workaround to create a Metafield Definition from existing Metafields?