# Add custom data Add a typed `specs.wattage` field to a product so a storefront can render a technical specification without parsing arbitrary text. This example deliberately makes the definition public because wattage is buyer-facing information. ## Before you begin Use an existing product and Admin permissions for metafield definitions and product updates. Check whether `specs.wattage` already exists for the product owner type. If it does, verify its kind and reuse it. See [Metafields and metadata](/concepts/custom-data/metafields) before choosing another data model. ## 1. Define the field Admin API ```graphql mutation DefineWattage($input: MetafieldCreateInput!) { metafieldCreate(input: $input) { metafieldDefinition { id namespace key ownerType kind } errors { __typename ... on UserError { message } } } } ``` Variables ```json { "input": { "name": "Wattage", "namespace": "specs", "key": "wattage", "kind": "INTEGER", "ownerType": "PRODUCT", "isPrivate": false, "minIntegerValue": 0 } } ``` Keep the returned definition ID. For information not intended for buyers, use a private definition and verify the owner's public surface before storing data. Neither metadata nor a public metafield is a place for credentials or internal business information. ## 2. Assign the value through the product Admin API ```graphql mutation SetLampWattage($input: ProductUpdateInput!) { productUpdate(input: $input) { product { id metafields(namespace: "specs", keys: ["wattage"]) { __typename key ... on IntegerMetafield { value } } } errors { __typename ... on UserError { message } } } } ``` Variables ```json { "input": { "id": "", "metafields": [ { "id": "", "value": { "integer": 40 } } ] } } ``` The integer is assigned using the typed `integer` member. Do not encode it as text to bypass the definition. Preserve other values according to the owner input's documented update semantics. ## 3. Read through Storefront Storefront API ```graphql query LampWattage($id: ID!) { product(id: $id) { id metafields(namespace: "specs", keys: ["wattage"]) { __typename key ... on IntegerMetafield { value } } } } ``` Variables ```json { "id": "" } ``` Expect an integer value of 40 on the public product. If the field is absent, check the definition's visibility, owner, assigned value, and product visibility before duplicating it elsewhere. To make the field a filter, follow [Configure and render facets](/guides/storefront/facets).