Home > @infiniteobjects/shopify-data-manager > AdminTypes > MetafieldInput
The input fields to use to create or update a metafield through a mutation on the owning resource. An alternative way to create or update a metafield is by using the [metafieldsSet](https://shopify.dev/api/admin-graphql/latest/mutations/metafieldsSet) mutation.
Signature:
export interface MetafieldInput
Property | Modifiers | Type | Description |
---|---|---|---|
id? | InputMaybe<Scalars[‘ID’][‘input’]> | <p>(Optional) The unique ID of the metafield.</p><p>Required when updating a metafield, but shouldn’t be included when creating as it’s created automatically.</p> | |
key? | InputMaybe<Scalars[‘String’][‘input’]> | <p>(Optional) The unique identifier for a metafield within its namespace.</p><p>Required when creating a metafield, but optional when updating. Used to help identify the metafield when updating, but can’t be updated itself.</p><p>Must be 3-64 characters long and can contain alphanumeric, hyphen, and underscore characters.</p> | |
namespace? | InputMaybe<Scalars[‘String’][‘input’]> | <p>(Optional) The container for a group of metafields that the metafield is or will be associated with. Used in tandem with key to lookup a metafield on a resource, preventing conflicts with other metafields with the same key .</p><p>Required when creating a metafield, but optional when updating. Used to help identify the metafield when updating, but can’t be updated itself.</p><p>Must be 3-255 characters long and can contain alphanumeric, hyphen, and underscore characters.</p> |
|
type? | InputMaybe<Scalars[‘String’][‘input’]> | <p>(Optional) The type of data that is stored in the metafield. Refer to the list of [supported types](https://shopify.dev/apps/metafields/types).</p><p>Required when creating a metafield, but optional when updating.</p> | |
value? | InputMaybe<Scalars[‘String’][‘input’]> | (Optional) The data stored in the metafield. Always stored as a string, regardless of the metafield’s type. |