Cert++
Close

CartCheckoutSession state and checkout session flow actions

Key Takeaway

Use Checkout Session Action to get or create the session, then use Update Checkout Session Action to change its state. The update happens only when the session's current state matches expCurrentState.

A checkout session tracks a buyer's cart while it moves through checkout in Lightning B2B Commerce. The session is stored as a CartCheckoutSession record linked to a WebCart. Its State field records where checkout currently stands. Two B2B Commerce flow actions manage the session. Checkout Session Action starts or gets the session, and Update Checkout Session Action moves it safely from one state to the next. When you customize a checkout flow, you work with these actions and the session state they change.

The CartCheckoutSession record

CartCheckoutSession represents a checkout session used in Lightning B2B Commerce checkout. The object is available in API version 48.0 and later, and only when the B2B Commerce or D2C Commerce license is enabled.

Each checkout session is tied to a single cart through WebCartId, but one cart can have multiple checkout sessions. You can set WebCartId when you create the record, but you can't update it afterward.

FieldWhat it holds
StateThe current state of the session, as a string
NextStateThe state the session moves to next, as a string
BackgroundOperationIdThe ID of the background operation in progress
OrderIdThe ID of the order created after the session goes from cart to order

Three boolean flags describe the session, and all three default to false:

  • IsProcessing is true while checkout processing is in progress.
  • IsError is true when the session is in an error state.
  • IsArchived is true when checkout processing is archived.

Archiving can't be undone. After a session's IsArchived is set to true, the session can't be unarchived.

In API version 63.0 and later, LWR stores don't populate CartCheckoutSession.OrderReferenceNumber at checkout. They populate the InitialOrderReferenceNumber field on WebCart instead.

Salesforce Accredited B2B Commerce Developer Professional Study Guide

Checklist progress

0/124Learned

Customize existing checkout flows in order to address the most common customer needs and provide an optimal Storefront experience

0/19

Prepare for the Exam

Play Today's Certle

Study Community

Ask questions and get the latest info from other Salesforce Accredited B2B Commerce Developer Professional studiers.