Create Cart Metafield
API operation: Open the endpoint in the API reference
Use POST /carts/{cart_id}/metafields to create a cart metafield. The current public operation is CartMetafield.register.
If available, the operation allows authenticated roles 0, 2, and 5; ordinary cross-user access is rejected, and the cart UUID is resolved for the selected user. This is broader than administrator-only access.
Keys beginning with extra_value are included in cart-total calculation when their value type is numeric; the extra_value_ prefix is a narrower naming convention. Consult the API reference and Extra attributes (Metafields) for current fields and value types.
OpenAPI reference
Operation: POST /carts/{cart_id}/metafields
Path parameters
| Name | Type | Required | Description |
|---|---|---|---|
cart_id | string | Yes | — |
Header parameters
| Name | Type | Required | Description |
|---|---|---|---|
X-SOCKET-ID-X | string | No | — |
Request body fields
| Name | Type | Required |
|---|---|---|
model | any | Yes |
object_id | integer | Yes |
user_id | any | No |
value | any | Yes |
value_type | string | Yes |
Responses
| Code | Description |
|---|---|
| 200 | OK (Envelope) |
| 400 | Bad Request (ErrorResponse) |
| 401 | Unauthorized |
| 404 | Not Found |
| 429 | Too Many Requests (ErrorResponse) |
| 500 | Internal Server Error (ErrorResponse) |
| 503 | Service Unavailable (ErrorResponse) |