# `metafield.set` Set a metafield value on a product, variant, collection, or the store. - **scope**: `catalog:write` - **storefront-visible** (bumps the catalog generation): yes - **destructive**: no ## Payload | field | type | required | notes | |---|---|---|---| | `ownerType` | "product" \| "variant" \| "collection" \| "store" | yes | | | `ownerId` | string (≤64 chars) | yes | | | `namespace` | string (/^(custom\|app\.[a-z0-9-]{2,32})$/) | yes | | | `key` | string (/^[a-z0-9_]{1,64}$/) | yes | | | `value` | object | yes | | ### JSON Schema ```json { "$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 } ```