Metadata is different from metafields. Metadata is simple JSON storage (untyped, no schema), while metafields are structured, typed, and schema-defined. Use metadata for integration data and internal tracking. Use metafields for customer-facing custom attributes.
Cart Metadata
You can attach metadata when creating a cart:Cart Metadata (Update)
Update metadata on an existing cart:Item Metadata
Attach metadata to individual items when adding or updating them:When Adding an Item
When Updating an Item
Updating metadata merges with existing values rather than replacing them:Metadata values can be any JSON-serializable type: strings, numbers, booleans, arrays, or nested objects.
Metadata Structure
Metadata is stored as a flat JSON object. You can use any keys and values:Metadata vs Metafields
Spree has two permanent, complementary systems for custom data — metadata for machines, metafields for humans.
Both systems are here to stay. For more details on metafields, see the Metafields guide.

