Skip to main content

Cart API

Overview

The Cart API provides endpoints for managing shopping carts in your EverShop store. These endpoints allow you to create carts, add or remove items, set customer information, specify shipping and billing addresses, and select shipping and payment methods.

Endpoints

Create a New Cart

Creates a new shopping cart in the system. You can optionally include customer information and initial cart items.

Request Schema (application/json)
Field NameField TypeRequired
customer_full_namestringNo
customer_emailstringNo
itemsarray of objectYes
Field NameField TypeRequired
skustringYes
qtyintegerYes
POST/api/carts
curl
-H "Accept: application/json"
--data-raw "<JSON DATA>"
https://<your domain>/api/carts
Sample Of Response
{
"data": {
"items": {
"cart_item_id": "2sl0ifz1etgldt28vm9",
"uuid": "4a6e5c9e0062489e82a472aeda0211be",
"product_id": 2,
"product_sku": "NJC90842-Blue-S",
"group_id": 1,
"product_name": "Lite racer adapt 3.0 shoes",
"thumbnail": "/assets/catalog/7385/1316/plv1138-Blue-thumb.png",
"product_weight": 5.4,
"product_price": 823,
"product_price_incl_tax": 823,
"qty": 10,
"final_price": 823,
"tax_percent": 0,
"tax_amount": 0,
"final_price_incl_tax": 823,
"variant_group_id": 62,
"variant_options": "[{"attribute_code":"size","attribute_name":"Size","attribute_id":2,"option_id":25,"option_text":"S"},{"attribute_code":"color","attribute_name":"Color","attribute_id":3,"option_id":8,"option_text":"Blue"}]",
"product_custom_options": null,
"productUrl": "/product/lite-racer-adapt-3.0-shoes",
"removeUrl": "/api/cart/mine/items/4a6e5c9e0062489e82a472aeda0211be",
"discount_amount": 0,
"total": 8230
},
"count": 3,
"cartId": "251ca17e754f4473a9bdf97c85509a4a"
}
}

Add Item to Cart

Adds a product to an existing cart. Specify the product SKU and quantity to add.

Request Schema (application/json)
Field NameField TypeRequired
skustringYes
qtystring or integerYes
POST/api/cart/363ba97f-8be7-4be9-be3f-a9f341f2b89f/items
curl
-H "Accept: application/json"
--data-raw "<JSON DATA>"
https://<your domain>/api/cart/363ba97f-8be7-4be9-be3f-a9f341f2b89f/items
Sample Of Response
{
"data": {
"item": [
{
"cart_item_id": "2sl0ifz1etgldt28vm9",
"uuid": "4a6e5c9e0062489e82a472aeda0211be",
"product_id": 2,
"product_sku": "NJC90842-Blue-S",
"group_id": 1,
"product_name": "Lite racer adapt 3.0 shoes",
"thumbnail": "/assets/catalog/7385/1316/plv1138-Blue-thumb.png",
"product_weight": 5.4,
"product_price": 823,
"product_price_incl_tax": 823,
"qty": 10,
"final_price": 823,
"tax_percent": 0,
"tax_amount": 0,
"final_price_incl_tax": 823,
"variant_group_id": 62,
"variant_options": "[{"attribute_code":"size","attribute_name":"Size","attribute_id":2,"option_id":25,"option_text":"S"},{"attribute_code":"color","attribute_name":"Color","attribute_id":3,"option_id":8,"option_text":"Blue"}]",
"product_custom_options": null,
"productUrl": "/product/lite-racer-adapt-3.0-shoes",
"removeUrl": "/api/cart/mine/items/4a6e5c9e0062489e82a472aeda0211be",
"discount_amount": 0,
"total": 8230
}
],
"count": 3,
"cartId": "251ca17e754f4473a9bdf97c85509a4a"
}
}

Remove Item from Cart

Removes a specific item from the cart. Requires the cart ID and the item ID to be removed.

Request Schema (application/json)
No request body required
DELETE/api/cart/363ba97f-8be7-4be9-be3f-a9f341f2b89f/items/433ba97f-8be7-4be9-be3f-a9f341f2b89f
curl
-H "Accept: application/json"
https://<your domain>/api/cart/363ba97f-8be7-4be9-be3f-a9f341f2b89f/items/433ba97f-8be7-4be9-be3f-a9f341f2b89f
Sample Of Response
{
"data": {
"item": {
"cart_item_id": 1138,
"uuid": "433ba97f-8be7-4be9-be3f-a9f341f2b89f",
"product_id": 1,
"product_sku": "NJC90842-Blue-X",
"group_id": 1,
"product_name": "Lite racer adapt 3.0 shoes",
"thumbnail": "/assets/catalog/1817/5605/plv1138-Blue-thumb.png",
"product_weight": 5.4,
"product_price": 823,
"product_price_incl_tax": 823,
"qty": 10,
"final_price": 823,
"tax_percent": 0,
"tax_amount": 0,
"final_price_incl_tax": 823,
"variant_group_id": 62,
"variant_options": "[{"attribute_code":"size","attribute_name":"Size","attribute_id":2,"option_id":4,"option_text":"X"},{"attribute_code":"color","attribute_name":"Color","attribute_id":3,"option_id":8,"option_text":"Blue"}]",
"product_custom_options": null,
"productUrl": "/product/lite-racer-adapt-3.0-shoes",
"removeUrl": "/api/cart/mine/items/19fa0c23bbd24edeaa3885940cf59f80",
"discount_amount": 0,
"total": 8230
}
}
}

Add Customer Information

Associates a customer email with the cart. This is a required step in the checkout process before adding addresses.

Request Schema (application/json)
Field NameField TypeRequired
emailstringYes
POST/api/carts/{id}/contacts
curl
-H "Accept: application/json"
--data-raw "<JSON DATA>"
https://<your domain>/api/carts/{id}/contacts
Sample Of Response
{
"data": {
"email": "customer@example.com"
}
}

Add Address

Adds a shipping or billing address to the cart. Both address types are required to complete the checkout process.

Request Schema (application/json)
Field NameField TypeRequired
addressobjectYes
Field NameField TypeRequired
full_namestringYes
telephonestring or numberYes
address_1stringYes
address_2stringNo
citystringYes
provincestringYes
countrystringYes
postcodestringYes
typestring (shipping, billing)Yes
POST/api/carts/{id}/addresses
curl
-H "Accept: application/json"
--data-raw "<JSON DATA>"
https://<your domain>/api/carts/{id}/addresses
Sample Of Response
{
"data": {
"cart_address_id": 461,
"uuid": "9c79451aa63211edb46b60d819134f39",
"full_name": "John Doe",
"postcode": "5000",
"telephone": "123456",
"country": "US",
"province": "CA",
"city": "California",
"address_1": "1234 Main St",
"address_2": null
}
}

Add Shipping Method

Specifies the shipping method to be used for the order. This step is required after adding a shipping address and before placing the order.

Request Schema (application/json)
Field NameField TypeRequired
method_codestringYes
POST/api/carts/363ba97f-8be7-4be9-be3f-a9f341f2b89f/shippingMethods
curl
-H "Accept: application/json"
--data-raw "<JSON DATA>"
https://<your domain>/api/carts/363ba97f-8be7-4be9-be3f-a9f341f2b89f/shippingMethods
Sample Of Response
{
"data": {
"method": {
"code": "free_shipping",
"name": "Free Shipping"
}
}
}

Add Payment Method

Specifies the payment method to be used for the order. This is the final step required before placing the order.

Request Schema (application/json)
Field NameField TypeRequired
method_codestringYes
POST/api/carts/363ba97f-8be7-4be9-be3f-a9f341f2b89f/paymentMethods
curl
-H "Accept: application/json"
--data-raw "<JSON DATA>"
https://<your domain>/api/carts/363ba97f-8be7-4be9-be3f-a9f341f2b89f/paymentMethods
Sample Of Response
{
"data": {
"method": {
"code": "paypal",
"name": "Paypal"
}
}
}

Add Shipping Note

Specifies the shipping note to be added to the order.

Request Schema (application/json)
Field NameField TypeRequired
notestringYes
POST/api/carts/363ba97f-8be7-4be9-be3f-a9f341f2b89f/shippingNotes
curl
-H "Accept: application/json"
--data-raw "<JSON DATA>"
https://<your domain>/api/carts/363ba97f-8be7-4be9-be3f-a9f341f2b89f/shippingNotes
Sample Of Response
{
"data": {
"note": "Please deliver between 5 PM and 7 PM"
}
}

Update Cart Item Quantity

Updates the quantity of an item in the cart. Supports both increasing and decreasing quantities.

Request Schema (application/json)
Field NameField TypeRequired
qtystring or integerYes
actionstring (increase, decrease)Yes
PATCH/api/cart/{cart_id}/items/{item_id}
curl
-H "Accept: application/json"
--data-raw "<JSON DATA>"
https://<your domain>/api/cart/{cart_id}/items/{item_id}
Sample Of Response
{
"data": {
"item": {
"cart_item_id": 1138,
"uuid": "433ba97f-8be7-4be9-be3f-a9f341f2b89f",
"qty": 3,
"final_price": 823,
"total": 2469
}
}
}

Add Item to My Cart

Adds an item to the currently authenticated customer's cart. This is a convenience endpoint that automatically resolves the customer's active cart.

Request Schema (application/json)
Field NameField TypeRequired
skustringYes
qtystring or integerYes
POST/api/cart/mine/items
curl
-H "Accept: application/json"
--data-raw "<JSON DATA>"
https://<your domain>/api/cart/mine/items
Sample Of Response
{
"data": {
"item": {
"cart_item_id": 1139,
"uuid": "553ba97f-8be7-4be9-be3f-a9f341f2b89f",
"product_sku": "PROD-001",
"qty": 1,
"final_price": 49.99
}
}
}

Remove Item from My Cart

Removes a specific item from the currently authenticated customer's cart.

Request Schema (application/json)
No request body required
DELETE/api/cart/mine/items/{item_id}
curl
-H "Accept: application/json"
https://<your domain>/api/cart/mine/items/{item_id}
Sample Of Response
{
"data": {
"item": {
"cart_item_id": 1139,
"uuid": "553ba97f-8be7-4be9-be3f-a9f341f2b89f"
}
}
}

Update Item Quantity in My Cart

Updates the quantity of an item in the currently authenticated customer's cart.

Request Schema (application/json)
Field NameField TypeRequired
qtystring or integerYes
actionstring (increase, decrease)Yes
PATCH/api/cart/mine/items/{item_id}
curl
-H "Accept: application/json"
--data-raw "<JSON DATA>"
https://<your domain>/api/cart/mine/items/{item_id}
Sample Of Response
{
"data": {
"item": {
"cart_item_id": 1139,
"uuid": "553ba97f-8be7-4be9-be3f-a9f341f2b89f",
"qty": 2
}
}
}

Checkout Cart

Initiates the checkout process for a cart, creating an order.

Request Schema (application/json)
Field NameField TypeRequired
cart_idstringYes
POST/api/carts/{cart_id}/checkout
curl
-H "Accept: application/json"
--data-raw "<JSON DATA>"
https://<your domain>/api/carts/{cart_id}/checkout
Sample Of Response
{
"data": {
"order_id": 2070,
"uuid": "7afebbbd-69f6-4e2c-84c5-5b899173b867",
"order_number": "12070"
}
}

Get Cart Data with GraphQL

EverShop uses GraphQL for querying cart data. For detailed information on how to query carts, refer to the GraphQL API documentation.