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