metafield.set

Set a metafield value on a product, variant, collection, or the store.

Payload

fieldtyperequirednotes
ownerType"product" | "variant" | "collection" | "store"yes
ownerIdstring (≤64 chars)yes
namespacestring (/^(custom|app\.[a-z0-9-]{2,32})$/)yes
keystring (/^[a-z0-9_]{1,64}$/)yes
valueobjectyes

JSON Schema

{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "type": "object",
  "properties": {
    "ownerType": {
      "type": "string",
      "enum": [
        "product",
        "variant",
        "collection",
        "store"
      ]
    },
    "ownerId": {
      "type": "string",
      "minLength": 1,
      "maxLength": 64
    },
    "namespace": {
      "type": "string",
      "pattern": "^(custom|app\\.[a-z0-9-]{2,32})$"
    },
    "key": {
      "type": "string",
      "pattern": "^[a-z0-9_]{1,64}$"
    },
    "value": {}
  },
  "required": [
    "ownerType",
    "ownerId",
    "namespace",
    "key",
    "value"
  ],
  "additionalProperties": false
}
Generated from the live platform registries at build time — reference pages cannot go stale. Markdown variant: /reference/commands/metafield.set.md