Understand saved carts

By default, Commerce supports creation and management of one shopping cart per shopper, per storefront.

The saved cart feature lets a shopper save multiple unfinished carts and retrieve them later. A shopper can create an order with only one cart at a time, though they can merge saved carts into the current cart.

This feature is available for both individual registered shoppers and account-based shoppers. If an account-based shopper is a member of more than one account, they cannot access their saved carts across accounts. That is, they can access saved carts only for the account for which they are currently logged into the store.

The order state for a saved card is INCOMPLETE, which specifies that the order is still in the purchasing stages. See Understand order states for more information.

To support saved carts, the getAllOrdersForProfile endpoint of the Store API includes a Boolean query parameter, incompleteOnly. The following sample request returns only incomplete orders for the logged-in shopper profile:

GET /ccstoreui/v1/orders/getAllOrdersForProfile?incompleteOnly=true

Once you enable the saved carts feature, a cartName order property is available to specify the cart associated with the order. This property will appear in the body of all webhooks that send order information, as well as in any REST API response that includes an order. The value of cartName is the string the shopper entered when they saved the cart.

A new view model, multiCartViewModel, is used to list all incomplete orders and provide support for pagination and search by cartName when a shopper wants to view their list of saved carts.

Note: When you enable saved carts, it is possible, though unlikely, that a shopper might see old incomplete carts the first time they view their saved cart list in their profile. This can occur if something unexpected happened during a past order flow; for example, if a shopper added items to their cart before logging in and the cart did not merge properly after login, an incomplete cart might have remained in the system. That cart would appear in the shopper’s saved cart list. Shoppers can simply delete any older carts that appear the first time they view their saved carts list.

Enabling the saved carts feature does not affect scheduled orders, as Commerce maintains schedule information separately.

If you configured Commerce to use the External Price Group and Catalog webhook to assign a shopper a specific catalog and price group at login, and the shopper then opens a saved cart, Commerce reprices the cart based on the catalog and price group specified by the webhook response. See Assign Catalogs and Price Groups to Shoppers for more information about this webhook.