Merge Guest Cart to Customer
curl --request POST \
--url https://api.headlesscommerce.io/v1/storefront/carts/{id}/merge \
--header 'Authorization: Bearer <token>' \
--header 'X-Customer-Token: <api-key>'{
"id": "<string>",
"session_id": "<string>",
"customer_id": "<string>",
"items": [
{
"id": "<string>",
"variant_id": "<string>",
"product_id": "<string>",
"product_name": "<string>",
"variant_name": "<string>",
"sku": "<string>",
"image_url": "<string>",
"quantity": 123,
"unit_price": {
"amount": 123,
"currency": "<string>"
},
"line_discount": {
"amount": 123,
"currency": "<string>"
},
"line_total": {
"amount": 123,
"currency": "<string>"
},
"metadata": {}
}
],
"shipping_address": {
"name": "<string>",
"company": "<string>",
"line1": "<string>",
"line2": "<string>",
"city": "<string>",
"state": "<string>",
"postal_code": "<string>",
"country": "<string>",
"phone": "<string>"
},
"billing_address": {
"name": "<string>",
"company": "<string>",
"line1": "<string>",
"line2": "<string>",
"city": "<string>",
"state": "<string>",
"postal_code": "<string>",
"country": "<string>",
"phone": "<string>"
},
"shipping_method_id": "<string>",
"discount_codes": [
"<string>"
],
"summary": {
"subtotal": {
"amount": 123,
"currency": "<string>"
},
"discount_total": {
"amount": 123,
"currency": "<string>"
},
"shipping_total": {
"amount": 123,
"currency": "<string>"
},
"tax_total": {
"amount": 123,
"currency": "<string>"
},
"total": {
"amount": 123,
"currency": "<string>"
},
"item_count": 123,
"total_quantity": 123
},
"applied_discounts": [
{
"discount_id": "<string>",
"code": "<string>",
"name": "<string>",
"value": 123,
"saved": {
"amount": 123,
"currency": "<string>"
}
}
],
"metadata": {},
"created_at": "2023-11-07T05:31:56Z",
"updated_at": "2023-11-07T05:31:56Z"
}Storefront - Cart
Merge Guest Cart to Customer
Merges a guest cart (identified by session_id) into the logged-in customer’s cart. If the customer has an existing cart, items are combined; otherwise, ownership is transferred.
POST
/
storefront
/
carts
/
{id}
/
merge
Merge Guest Cart to Customer
curl --request POST \
--url https://api.headlesscommerce.io/v1/storefront/carts/{id}/merge \
--header 'Authorization: Bearer <token>' \
--header 'X-Customer-Token: <api-key>'{
"id": "<string>",
"session_id": "<string>",
"customer_id": "<string>",
"items": [
{
"id": "<string>",
"variant_id": "<string>",
"product_id": "<string>",
"product_name": "<string>",
"variant_name": "<string>",
"sku": "<string>",
"image_url": "<string>",
"quantity": 123,
"unit_price": {
"amount": 123,
"currency": "<string>"
},
"line_discount": {
"amount": 123,
"currency": "<string>"
},
"line_total": {
"amount": 123,
"currency": "<string>"
},
"metadata": {}
}
],
"shipping_address": {
"name": "<string>",
"company": "<string>",
"line1": "<string>",
"line2": "<string>",
"city": "<string>",
"state": "<string>",
"postal_code": "<string>",
"country": "<string>",
"phone": "<string>"
},
"billing_address": {
"name": "<string>",
"company": "<string>",
"line1": "<string>",
"line2": "<string>",
"city": "<string>",
"state": "<string>",
"postal_code": "<string>",
"country": "<string>",
"phone": "<string>"
},
"shipping_method_id": "<string>",
"discount_codes": [
"<string>"
],
"summary": {
"subtotal": {
"amount": 123,
"currency": "<string>"
},
"discount_total": {
"amount": 123,
"currency": "<string>"
},
"shipping_total": {
"amount": 123,
"currency": "<string>"
},
"tax_total": {
"amount": 123,
"currency": "<string>"
},
"total": {
"amount": 123,
"currency": "<string>"
},
"item_count": 123,
"total_quantity": 123
},
"applied_discounts": [
{
"discount_id": "<string>",
"code": "<string>",
"name": "<string>",
"value": 123,
"saved": {
"amount": 123,
"currency": "<string>"
}
}
],
"metadata": {},
"created_at": "2023-11-07T05:31:56Z",
"updated_at": "2023-11-07T05:31:56Z"
}Authorizations
API Key. Example: sk_live_xxxxx or pk_live_xxxxx
Storefront customer authentication token. Issued via POST /admin/customers/{id}/token. Required for accessing /storefront/customers/, /storefront/orders/.
Path Parameters
Resource ID
Response
Success
Available options:
active, completed, abandoned Guest identification ID
Show child attributes
Show child attributes
Show child attributes
Show child attributes
Show child attributes
Show child attributes
Show child attributes
Show child attributes
Show child attributes
Show child attributes
⌘I