Skip to main content

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

NameTypeRequiredDescription
cart_idstringYes—

Header parameters

NameTypeRequiredDescription
X-SOCKET-ID-XstringNo—

Request body fields

NameTypeRequired
modelanyYes
object_idintegerYes
user_idanyNo
valueanyYes
value_typestringYes

Responses

CodeDescription
200OK (Envelope)
400Bad Request (ErrorResponse)
401Unauthorized
404Not Found
429Too Many Requests (ErrorResponse)
500Internal Server Error (ErrorResponse)
503Service Unavailable (ErrorResponse)
Open this operation in the API reference