API referenceStorefront

Add cart item

POST
/carts/{id}/items

Authorization

headerx-api-key<token>

Organization-scoped API key with scope metadata.

Path Parameters

id*string

Request Body

application/json
  1. body
productId*string
Length1 <= length
variantId?string
quantity*integer
Range0 < value <= 9007199254740991

Response Body

Item added

application/json
  1. response
id*string
items*array<>
totals*
shippingAddress*|null
billingAddress*|null
shippingMethod*|null
paymentMethod*|null
couponCode*string|null
couponError*string|null
requiresShipping*boolean
customerId*string|null
itemCount*number
createdAt*string
updatedAt*string
Example Request
curl -X POST 'https://api-prood.vercel.app/v1/carts/string/items' \  -H 'Content-Type: application/json' \  -d '{  "productId": "string",  "quantity": 1}'
Example Response
{  "id": "string",  "items": [    {      "id": "string",      "productId": "string",      "productSlug": "string",      "variantId": "string",      "name": {        "property1": "string",        "property2": "string"      },      "variantName": {        "property1": "string",        "property2": "string"      },      "image": {        "url": "string",        "alt": "string",        "width": 0,        "height": 0      },      "quantity": 0,      "price": {        "amount": 0,        "currency": "string",        "formatted": "string",        "originalAmount": 0,        "discountPercent": 0      },      "totalPrice": {        "amount": 0,        "currency": "string",        "formatted": "string"      }    }  ],  "totals": {    "subtotal": {      "amount": 0,      "currency": "string",      "formatted": "string"    },    "shipping": {      "amount": 0,      "currency": "string",      "formatted": "string"    },    "tax": {      "amount": 0,      "currency": "string",      "formatted": "string"    },    "discount": {      "amount": 0,      "currency": "string",      "formatted": "string"    },    "total": {      "amount": 0,      "currency": "string",      "formatted": "string"    }  },  "shippingAddress": {    "firstName": "string",    "lastName": "string",    "phone": "string",    "street": "string",    "street2": "string",    "city": "string",    "state": "string",    "country": "string",    "postalCode": "string"  },  "billingAddress": {    "firstName": "string",    "lastName": "string",    "phone": "string",    "street": "string",    "street2": "string",    "city": "string",    "state": "string",    "country": "string",    "postalCode": "string"  },  "shippingMethod": {    "id": "string",    "name": {      "property1": "string",      "property2": "string"    },    "provider": "string",    "fulfillmentType": "shipping",    "estimatedDays": {      "min": 0,      "max": 0    },    "price": {      "amount": 0,      "currency": "string",      "formatted": "string"    },    "cashOnDelivery": true  },  "paymentMethod": {    "id": "string",    "type": "string",    "name": {      "property1": "string",      "property2": "string"    },    "provider": "string",    "installments": {      "count": 0,      "amount": 0,      "currency": "string"    },    "icon": "string"  },  "couponCode": "string",  "couponError": "string",  "requiresShipping": true,  "customerId": "string",  "itemCount": 0,  "createdAt": "string",  "updatedAt": "string"}