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:Order Metadata
Update metadata on an existing order:Line Item Metadata
Attach metadata to individual line 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
| Metadata | Metafields | |
|---|---|---|
| Structure | Untyped JSON | Schema-defined, strongly typed |
| Validation | None | Type-specific validation |
| Visibility | Write-only in Store API | Configurable (public/private) |
| Admin UI | JSON preview | Dedicated form fields |
| Best for | Integration data, tracking, attribution | Product specs, custom fields, customer-facing data |
| API access | Write via Store API, read via Admin API | Read/write via both APIs |

