Carts
Entry Point: /carts/{scope}/default
A cart is basically a basket that customers put items into that they want to purchase. While Cortex API’s shopping cart has this as its core functionality, there is much more to this shopping cart than just that.
Key concepts developers should know about carts:
You can’t delete a cart, you can only empty a cart of its contents
You do not need to instantiate the cart, a cart is always available
You do not need to create an order for the cart, an order is always available
Cortex automatically persists carts between customer sessions so a customer can log on through a mobile phone and then log on through another device to complete the purchase
A cart’s line items is a collection of items that have been added to a cart. A line item can have one or more of the same items in it. For example, one line item can have seven Rocker T-Shirt or a single Rocker T-Shirt, but it won’t have one Rocker T-Shirt and a song track. The song track and T-shirt would be in separate line items.
Read Line Item
Retrieve a single line item from a shopper’s cart.
Workflow
- Start with cart
GET
the link with rel: lineitemsGET
the link with rel: element- Render the response
Response Fields
Type: carts.line-item
Name | Description | Type |
---|---|---|
quantity | The total number of items in the line item. | integer |
configuration | The details of the line item configuration. | object |
Update Line Item
Update the number of items in a line item. For example, if you have 4 Rockstar T-Shirts in a line item, you can use this method to remove 3 of the t-shirts and leave 1 T-shirt in the cart.
Workflow
- Start with line-item
- Edit the line-item object with new detail(s)
- Update line-item using a
PUT
request
Delete Line Item
Delete a line item from the cart.
Workflow
- Start with line-item
DELETE
line-item
Empty Cart
Remove all line items from the cart.
Workflow
- Start with cart
GET
the link with rel: lineitemsDELETE
line-items
Add Item To Default Cart
Add an item to the user’s default cart.
Workflow
- Start with item
GET
the link with rel: addtocartform- Fill out the form
POST
the form using the link with rel: addtodefaultcartaction
Read Line Item Cart
Retrieve the cart that has the given line item. This workflow is useful when you need to determine which cart the line item belongs to.
Workflow
- Start with line-item
GET
the link with rel: cart- Render the response
Response Fields
Type: carts.cart
Name | Description | Type |
---|---|---|
total-quantity | Lists the total number of items in the cart. | integer |
Read Default Cart
Retrieve the shopper’s default cart. When using default in the cart’s URI, default evaluates to the logged in shopper’s cart I.D. See the main Cortex documentation for more information on default.
Workflow
- Start with root
GET
the link with rel: defaultcart- Render the response
Response Fields
Type: carts.cart
Name | Description | Type |
---|---|---|
total-quantity | Lists the total number of items in the cart. | integer |
Read Cart Memberships
Retrieves the list of carts that the item has been added to. The list is empty if the item is not in your cart.
Workflow
- Start with item
GET
the link with rel: cartmemberships- Render the response
Read Add Items To Cart Form
Retrieve the add items to cart form on the cart.
Workflow
- Start with cart
GET
the link with rel: additemstocartform- Render the response
Add Items To Cart
Add multiple items to the cart.
Workflow
- Start with add-items-to-cart-form
- Fill out the form
POST
the form using the link with rel: additemstocartaction