Update Metafield

Update an existing metafield

The ​​Get Metafield API allows to update an existing metafield with new values while maintaining its association with the original resource.

This API is especially useful for:

  1. Modifying the value or description of an existing metafield.
  2. Changing the data type of a metafield while preserving its relationship with the owner resource.
  3. Updating metafield information that affects product displays, order processing or shop.

Request Parameters

Public Request Parameters

📘

Path Parameters

ParameterTypeRequiredDescriptionExample
owner_resourcestringyesThe type of resource the metafield is attached to. Available values: shop, product, product_image, product_variant, order, page, customer, collection, blog, articleproduct
owner_idstringyesThe unique ID of the resource to which the metafield is attachedprod_12345
idstringyesThe unique identifier for the metafieldmeta_67890

Body Parameters

ParameterTypeRequiredDescriptionExample
valuestringyesRepresents a dynamically typed value which can be either null, a number, a string, a boolean, a recursive struct value, or a list of values{"color": "blue", "size": "XL"}
typestringyesThe type of the metafield. Valid values: date, date_time, weight, volume, dimension, integer, number_decimal, file_reference, single_line_text_field, json, multi_line_text_field, color, rating, url, booleanjson
descriptionstringnoA brief description of the metafield's purpose or contentProduct color and size information

Response Explanation

Public Response Parameters

📘

Successful Response

FieldTypeExampleDescription
codestring"Success"Response status (e.g., "Success").
messagestring"Metafield created successfully"Response message.
data.metafield.idstring"mf_001"Unique ID of the created metafield.
data.metafield.store_idinteger12345ID of the store that owns the metafield.
data.metafield.owner_resourcestring"product"Resource type that owns the metafield (e.g., "product").
data.metafield.owner_idstring"prod_001"ID of the owner resource.
data.metafield.namespacestring"global"Namespace of the metafield.
data.metafield.keystring"color"Key of the metafield.
data.metafield.typestring"string"Type of the metafield ("json" or "string").
data.metafield.descriptionstring"Product primary color"Description of the metafield.
data.metafield.definition_idstring"df_12345"ID of the metafield definition (if applicable).
data.metafield.created_atstring"2023-10-25T14:30:00Z"Timestamp when the metafield was created (ISO 8601 format).
data.metafield.updated_atstring"2023-10-25T14:30:00Z"Timestamp when the metafield was last updated (ISO 8601 format).

Error Response

FieldTypeExampleDescription
codestringInvalidParameterError http message
messagestring``Error message

API Structure Overview

Language
Credentials
Header
URL
Click Try It! to start a request and see the response here!