You are here:
Add Cart Item Action
In a B2B Commerce Checkout flow, add an item to a cart.
Required Editions
| Available in: Lightning Experience |
| View supported editions. |
In Flow Builder, add an Action element to your flow. Select the
Commerce category, and search for Add Cart Item.
To access this action from REST API, use the name addCartItem.
Set Input Values
Use values from earlier in the flow to set the inputs.
| Input Parameter | Description |
|---|---|
| Cart State or ID | ID of the cart or state of the cart to add an item to. Valid state values are: active and current. A current cart is not closed or pending deletion. |
| effectiveAccountId | (Optional) ID of the buyer account or guest buyer profile for which the request is made. If unspecified, the default value is determined from context. |
| Web Store ID | The ID of the web store. |
| Cart Item Input | This input is an Apex-defined variable of class ConnectApi.CartItemInput, which includes these fields:
|
Store Output Values
Use output values later in the flow. The values are assigned when the item is created.
| Output Parameter | Description |
|---|---|
| Added Cart Item | This output is an Apex-defined variable of class ConnectApi.CartItem, which includes these fields:
|
Error Conditions
| Error Condition | Description |
|---|---|
The user doesn’t have access to the cart. |
Error Message: You don't have access to this cart. If possible, contact the admin for this web store. Error Code: INSUFFICIENT_ACCESS_OR_READONLY HTTP Status Code: 400 |

