Skip to main content
PUT
Update Metafield

Update Metafield

Updates the value (and optionally type) of a metafield owned by your app. The metafield is matched by id and appId — you cannot update metafields written by other apps or by merchants.

Request

Required scope

write_metafields

Path parameters

id
string
required
The metafield’s UUID (the id field from list/create responses).

Body parameters

value
any
The new value. Scalars sent as-is; compounds sent as JSON. Must validate against the (current or new) type.
type
string
Optional new type. The new value must validate against it.
namespace, key, ownerType, and ownerId cannot be changed. Create a new metafield and delete the old one if you need to move it.

Examples

Change a scalar value

Update a compound value

Update a list

Response

Cache invalidation

A successful update automatically expires the storefront caches for the owning resource. The next render sees the new value.

Error codes

CodeDescription
UNAUTHORIZEDInvalid or missing access token
FORBIDDENApp doesn’t have write_metafields scope
NOT_FOUNDMetafield does not exist, or wasn’t written by your app
VALIDATION_ERRORValue doesn’t match the (new) type or its validations