Cart API
Use the REST API to interact with EverShop carts.
Add item to cart
Use this endpoint to add item to cart.
Request Schema (application/json)
Field Name | Field Type | Required |
---|---|---|
sku | string | Yes |
qty | string or integer | Yes |
POST/api/cart/{id}/items
- cURL
- JavaScript
curl -H "Accept: application/json" -H "Cookie: admin_token=<your jwt token id>" https://<your domain>/api/cart/{id}/items
fetch('https://<your domain>/api/cart/{id}/items', { headers: { 'Accept': 'application/json', 'Cookie': 'admin_token=<your jwt token id>' }}) .then(response => response.json()) .then(data => { if(data.error) { // Handle the error } else { // Handle the data } }) .catch(error => { // Handle the error });
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
Use this endpoint to remove item from cart.
Request Schema (application/json)
No request body requiredDELETE/api/cart/{id}/items/{itemId}
- cURL
- JavaScript
curl -H "Accept: application/json" -H "Cookie: admin_token=<your jwt token id>" https://<your domain>/api/cart/{id}/items/{itemId}
fetch('https://<your domain>/api/cart/{id}/items/{itemId}', { headers: { 'Accept': 'application/json', 'Cookie': 'admin_token=<your jwt token id>' }}) .then(response => response.json()) .then(data => { if(data.error) { // Handle the error } else { // Handle the data } }) .catch(error => { // Handle the error });
Sample Of Response
{ "data": { "item": { "cart_item_id": 1138, "uuid": "19fa0c23bbd24edeaa3885940cf59f80", "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 info
Use this endpoint to add customer email to cart.
Request Schema (application/json)
Field Name | Field Type | Required |
---|---|---|
string | Yes |
POST/api/cart/{id}/contacts
- cURL
- JavaScript
curl -H "Accept: application/json" -H "Cookie: admin_token=<your jwt token id>" https://<your domain>/api/cart/{id}/contacts
fetch('https://<your domain>/api/cart/{id}/contacts', { headers: { 'Accept': 'application/json', 'Cookie': 'admin_token=<your jwt token id>' }}) .then(response => response.json()) .then(data => { if(data.error) { // Handle the error } else { // Handle the data } }) .catch(error => { // Handle the error });
Sample Of Response
{ "data":{"email":"paypal@gmail.com"}}}
Add address
Use this endpoint to add address (Billing or Shipping) to cart.
Request Schema (application/json)
Field Name | Field Type | Required | |||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
address | object | Yes | |||||||||||||||||||||||||||
| |||||||||||||||||||||||||||||
type | string (shipping, billing) | Yes |
POST/api/cart/{id}/addresses
- cURL
- JavaScript
curl -H "Accept: application/json" -H "Cookie: admin_token=<your jwt token id>" https://<your domain>/api/cart/{id}/addresses
fetch('https://<your domain>/api/cart/{id}/addresses', { headers: { 'Accept': 'application/json', 'Cookie': 'admin_token=<your jwt token id>' }}) .then(response => response.json()) .then(data => { if(data.error) { // Handle the error } else { // Handle the data } }) .catch(error => { // Handle the error });
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
Use this endpoint to add shipping method to cart.
Request Schema (application/json)
Field Name | Field Type | Required |
---|---|---|
method_code | string | Yes |
method_name | string | Yes |
POST/api/cart/{id}/shippingMethods
- cURL
- JavaScript
curl -H "Accept: application/json" -H "Cookie: admin_token=<your jwt token id>" https://<your domain>/api/cart/{id}/shippingMethods
fetch('https://<your domain>/api/cart/{id}/shippingMethods', { headers: { 'Accept': 'application/json', 'Cookie': 'admin_token=<your jwt token id>' }}) .then(response => response.json()) .then(data => { if(data.error) { // Handle the error } else { // Handle the data } }) .catch(error => { // Handle the error });
Sample Of Response
{ "data": { "method": { "code": "free_shipping", "name": "Free Shipping" } }}
Add payment method
Use this endpoint to add payment method to cart.
Request Schema (application/json)
Field Name | Field Type | Required |
---|---|---|
method_code | string | Yes |
method_name | string | Yes |
POST/api/cart/{id}/paymentMethods
- cURL
- JavaScript
curl -H "Accept: application/json" -H "Cookie: admin_token=<your jwt token id>" https://<your domain>/api/cart/{id}/paymentMethods
fetch('https://<your domain>/api/cart/{id}/paymentMethods', { headers: { 'Accept': 'application/json', 'Cookie': 'admin_token=<your jwt token id>' }}) .then(response => response.json()) .then(data => { if(data.error) { // Handle the error } else { // Handle the data } }) .catch(error => { // Handle the error });
Sample Of Response
{ "data": { "method": { "code": "paypal", "name": "Paypal" } }}