namespace and a key.
Read metafields
Every storefront response includes ametafields array. It’s empty when the resource has none:
value comes back exactly as it was written: a number written as "42" reads back as the string "42".
Write metafields
Sendmetafields_attributes on a company create or update. Each entry needs namespace, key, value, and value_type. description is optional.
- Matched by
namespaceandkey. An entry that matches an existing metafield replaces it. A new pair adds a metafield. - Everything else is kept. Metafields you don’t send are left as they are. Omitting
metafields_attributes, or sending[], changes nothing. descriptionis kept if you leave it out. Send a new one to change it.- All or nothing. If any entry is invalid, the request returns
422and none of the metafields change.
Delete a metafield
Send the entry with_destroy: true. value and value_type are still required, so include them:
Naming rules
namespace: up to 20 characters.key: up to 30 characters.- Both may contain only letters, digits, and underscores.
- A
namespaceandkeypair is unique on each resource.
custom or your app’s name, so they don’t collide with anyone else’s.
Value types
value_type says what kind of value a metafield holds. Fluid checks value against it: "abc" as a number_integer returns 422.
A few rules catch people out:
booleantakes JSONtrueorfalse. The string"true"is rejected.coloris#RGBor#RRGGBB.urlmust start withhttp://orhttps://.- Measurements are objects with exact keys. For example,
moneyis{"amount": ..., "currency_code": ...}.
Metafield definitions
A store can define its metafields in Fluid Admin: the type eachnamespace and key must have, and rules such as a minimum, a maximum, a list of allowed choices, or a pattern. When a definition matches a metafield you write, Fluid enforces it. A value of the wrong type, or one that breaks a rule, returns 422.
A definition never hides a metafield or makes it required. locked in a response shows whether the matching definition is locked in Fluid Admin, or null when there is no definition.
Search, translation, and themes
- Search. A list’s
qsearch matches metafield values. You can’t filter a list by a metafield. - Translation. Metafields aren’t translated. A translation PATCH (a write with a non-default
lang) ignoresmetafields_attributes, except on products. See Translations. - Themes. Liquid templates read product, variant, and enrollment pack metafields as
resource.metafields.<namespace>.<key>, for exampleproduct.metafields.custom.material.
Current limitations
Two resources don’t follow the rules above yet:
- Collections don’t accept
metafields_attributesthrough v2026-04. - Products can add a new metafield through v2026-04, but can’t change or delete an existing one. Sending an existing
namespaceandkeyagain returns422.
Next steps
- Find and create resources — set metafields when you create a resource.
- Storefront resources — the body key each resource uses.