App reviews, troubleshooting, and recommendations
I'm using the graphql api to create a metafield definition and I'm getting the following error:
GraphqlQueryError: Argument 'ownerType' on InputObject 'MetafieldDefinitionInput' has an invalid value ("PRODUCT"). Expected type 'MetafieldOwnerType!'.
Here's my request:
mutation metafieldDefinitionCreate {
metafieldDefinitionCreate(definition: {
name: "Foo",
namespace: "mynamespace",
key: "foo",
description: "Foo Object.",
type: "metaobject_reference",
ownerType: "PRODUCT",
validations: [{ name: "metaobject_definition_id", metaobjectDefinitionId: "gid://shopify/MetaobjectDefinition/12312313" }]
}
) {
metafieldDefinition {
id
}
userErrors {
field
message
}
}
}
But when i check the doucmentation https://shopify.dev/docs/api/admin-graphql/2024-01/enums/MetafieldOwnerType#value-product-product
PRODUCT is in fact a valid value given the documentation.
And even in the docs for metafieldDefinitionCreate even have the following example that shows ownerType with the exact same value:
{
"definition": {
"name": "Ingredients",
"namespace": "bakery",
"key": "ingredients",
"description": "A list of ingredients used to make the product.",
"type": "multi_line_text_field",
"ownerType": "PRODUCT"
}
}
you should use this
Discover how to increase the efficiency of commerce operations with Shopify Academy's l...
By Jacqui Mar 26, 2025Shopify and our financial partners regularly review and update verification requiremen...
By Jacqui Mar 14, 2025Unlock the potential of marketing on your business growth with Shopify Academy's late...
By Shopify Mar 12, 2025