Broadleaf Microservices
  • v1.0.0-latest-prod

Broadleaf Cart Operation Services

Overview

This service provides management of the cart and checkout workflows. It handles:

  • Logic for adding, updating, and removing cart items along with any corresponding validation

  • Adding or removing promo codes, fulfillment info, and payment methods

  • Processing the final checkout submission

    • Validating configurable items

    • Validating and confirming payments

    • Validating fulfillment info

    • Validating and decrementing inventory

However, it does not provide the actual persistence facilities—those are deferred to the Cart Services through the CartProvider component. Moreover, catalog, pricing, and inventory info are also handled through their respective providers—anything that requires a persistent store.

Context Diagram for Cart Operations Services
Figure 1. Context Diagram describing relationships with other services

Usage

Cart and Checkout

Overview

Cart Operation is primarily used through CartOperationEndpoint and CheckoutEndpoint. CartOperationEndpoint handles requests for managing the cart’s items, attributes, and promo codes while CheckoutEndpoint handles updating contact, fulfillment, and payment information as well as the final checkout submission.

Tip
See the Cart Operation API spec for request and response details.
Sequence Diagram for Add to Cart
Figure 2. Add to Cart Sequence Diagram
Sequence Diagram for Checkout
Figure 3. Checkout Sequence Diagram

Cart Resolution

Carts are resolved and operated upon using the ID of the Cart. Once a cart is created for a customer, the Cart ID can be saved for later retrievals and operations using the ManageCartEndpoint. For registered customers, an in-progress cart may be retrieved by using the ResolveCartEndpoint after they sign-in. Learn more about Cart resolution.

Item Lists

Cart Operation also allows management of ItemLists that can be used for simple lists of items like wishlists that do not require all of the overhead that goes with a cart. Lists are primarily used through ItemListOperationEndpoint and ItemListItemOperationEndpoint.

Tip
See the Item List and Item List Item API specs for other request and response details.

The ItemListOperationEndpoint even exposes a method to add entire lists to a customer’s cart in one call.

Add List to Cart

POST /cart/{cartId}/item-lists

Request Payload
{
  "itemListIds": [
    "item-list-1",
    "item-list-2",
    "item-list-3"
  ]
}
Response Payload
{
  "cart": {},
  "inaccessibleItemListIds": [ "item-list-2" ],
  "failedItemAdditions": {
    "item-list-1": [ "item-2" ],
    "item-list-3": [ "item-1", "item-4" ]
  }
}

Cart History

For those not using the Order Services, Cart Operations provides a CartHistoryEndpoint to allow reading historical, submitted carts for customers or by order number.

Tip
See the Cart History API spec for request and response details.

CSR

Cart Operations exposes a specialized endpoint for CSR operations: CSRCartEndpoint. This allows overriding item and fulfillment pricing, cloning or viewing a customer’s cart, and transferring a CSR-owned cart to a customer.