---
schema_version: "1"
id: b6f0347fc36010e97fc2e7e1293c11e8ceb4f61841fda262c37b6b1e909959fc
title: Add Cart Item Action
collection: admin
version: current
locale: en-us
portal_url: https://docs.salesforce.com/admin/current/en-us/platform/264-0-0/flow_ref_elements_comm_actions_add_cart_item.md
canonical_url: https://help.salesforce.com/s/articleView?id=platform.flow_ref_elements_comm_actions_add_cart_item.htm&release=264.0.0&type=5
source_site: help.salesforce.com
content_type: documentation
content_hash: f1fee19c2dd61ccb8c48095f6724124afe7af33de11b6cc15f1b7a71692d09dc
description: In a B2B Commerce Checkout flow, add an item to a cart.
products:
  - Flow Builder
  - Salesforce Platform
release: "264"
---
# Add Cart Item Action

In a B2B Commerce Checkout flow, add an item to a cart.

### Required Editions

<table class="slds-table slds-table_bordered slds-max-medium-table_stacked slds-m-bottom_small edition"><colgroup><col></colgroup><tbody><tr class=""><td class="slds-cell-wrap" style="vertical-align:top;">Available in: Lightning Experience</td></tr><tr class=""><td class="slds-cell-wrap" style="vertical-align:top;"><a href="https://help.salesforce.com/s/articleView?id=platform.flow_ref_supported_editions.htm&amp;release=264.0.0&amp;type=5" title="Learn about the editions and user interfaces that support Flow Builder. Some Flow Builder features integrate with other Salesforce products that require additional licenses.">View supported editions.</a></td></tr></tbody></table>

![Note](https://sf-zdocs-cdn-prod.zoominsoftware.com/tdta-platform-platform_automation-264-0-0-production-enus/60568438-ec7e-4665-acd1-7c80dcbe60d5/images/icon_note.png)

Note Cart actions aren’t available in flows for B2B stores built on an Aura template. To build a B2B Commerce Checkout flow for an Aura store, see [B2B Commerce Checkout Flow (Aura)](https://developer.salesforce.com/docs/commerce/salesforce-commerce/guide/b2b-b2c-comm-setup-checkout-flow.html).

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.

<table class="slds-table slds-table_bordered slds-max-medium-table_stacked slds-m-bottom_small ">
        <colgroup>
          <col style="width:17.006802721088434%">
          <col style="width:82.99319727891157%">
        </colgroup>
        <thead class="slds-text-title_caps ">
          <tr class="">
            <th scope="col" class="slds-cell-wrap" style="vertical-align:top;" id="d46814e86">Input Parameter</th>
            <th scope="col" class="slds-cell-wrap" style="vertical-align:top;" id="d46814e88">Description</th>
          </tr>
        </thead>
        <tbody>
          <tr class="">
            <td data-label="Input Parameter" class="slds-cell-wrap" style="vertical-align:top;" headers="d46814e86 "><strong class="uicontrol">Cart State or ID</strong></td>
            <td data-label="Description" class="slds-cell-wrap" style="vertical-align:top;" headers="d46814e88 ">ID of the cart or state of the cart to add an item to. Valid state values are:
              <kbd>active</kbd> and <kbd>current</kbd>. A current cart is not
              closed or pending deletion.
            </td>
          </tr>
          <tr class="">
            <td data-label="Input Parameter" class="slds-cell-wrap" style="vertical-align:top;" headers="d46814e86 "><strong class="uicontrol">effectiveAccountId</strong></td>
            <td data-label="Description" class="slds-cell-wrap" style="vertical-align:top;" headers="d46814e88 "> (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.</td>
          </tr>
          <tr class="">
            <td data-label="Input Parameter" class="slds-cell-wrap" style="vertical-align:top;" headers="d46814e86 "><strong class="uicontrol">Web Store ID</strong></td>
            <td data-label="Description" class="slds-cell-wrap" style="vertical-align:top;" headers="d46814e88 ">The ID of the web store.</td>
          </tr>
          <tr class="">
            <td data-label="Input Parameter" class="slds-cell-wrap" style="vertical-align:top;" headers="d46814e86 "><strong class="uicontrol">Cart Item Input</strong></td>
            <td data-label="Description" class="slds-cell-wrap" style="vertical-align:top;" headers="d46814e88 ">
              <p>This input is an Apex-defined variable of class <a href="https://developer.salesforce.com/docs/atlas.en-us.apexcode.meta/apexcode/apex_connectapi_input_cart_item.htm" target="_blank">ConnectApi.CartItemInput</a>, which includes these fields:</p>
              <ul>
                <li><strong class="uicontrol">productId</strong> — ID of the product.</li>
                <li><strong class="uicontrol">quantity</strong> — Quantity of the cart item. Use a value that can
                  be converted to BigDecimal.</li>
                <li><strong class="uicontrol">type</strong> — Type of the cart item. The only valid value is
                  <kbd>Product</kbd>.
                </li>
              </ul>
            </td>
          </tr>
        </tbody>
      </table>

## Store Output Values

Use output values later in the flow. The values are assigned when the item is created.

<table class="slds-table slds-table_bordered slds-max-medium-table_stacked slds-m-bottom_small ">
        <colgroup>
          <col style="width:17.513134851138354%">
          <col style="width:82.48686514886164%">
        </colgroup>
        <thead class="slds-text-title_caps ">
          <tr class="">
            <th scope="col" class="slds-cell-wrap" style="vertical-align:top;" id="d46814e152">Output Parameter</th>
            <th scope="col" class="slds-cell-wrap" style="vertical-align:top;" id="d46814e154">Description</th>
          </tr>
        </thead>
        <tbody>
          <tr class="">
            <td data-label="Output Parameter" class="slds-cell-wrap" style="vertical-align:top;" headers="d46814e152 "><strong class="uicontrol">Added Cart Item</strong></td>
            <td data-label="Description" class="slds-cell-wrap" style="vertical-align:top;" headers="d46814e154 ">
              <p>This output is an Apex-defined variable of class <a href="https://developer.salesforce.com/docs/atlas.en-us.apexcode.meta/apexcode/apex_connectapi_output_cart_item.htm" target="_blank">ConnectApi.CartItem</a>, which includes these fields:</p>
              <ul>
                <li><strong class="uicontrol">itemizedAdjustment​Amount</strong> — Total itemized adjustment
                  amount for the item, including promotions and excluding taxes.</li>
                <li><strong class="uicontrol">listPrice</strong> — List price for the item.</li>
                <li><strong class="uicontrol">salesPrice</strong> — Sales price for the item.</li>
                <li><strong class="uicontrol">totalAdjustmentAmount</strong> — Adjustments made to the unit price
                  for the item. This value is informational only and isn’t used in pricing
                  calculations.</li>
                <li><strong class="uicontrol">totalAmount</strong> — Total amount for the item.</li>
                <li><strong class="uicontrol">totalListPrice</strong> — Total list price for the item.</li>
                <li><strong class="uicontrol">totalPrice</strong> — Total price for the item including adjustments
                  but excluding taxes.</li>
                <li><strong class="uicontrol">totalTax</strong> — Total tax for the item.</li>
                <li><strong class="uicontrol">unitAdjustedPrice</strong> — Unit price, including adjustments, for
                  the item. This value is informational only and isn’t used in pricing calculations.</li>
                <li><strong class="uicontrol">unitAdjustmentAmount</strong> — Total amount including discounts,
                  but excluding shipping and tax, for product items in the cart.</li>
              </ul>
            </td>
          </tr>
        </tbody>
      </table>

## Error Conditions

<table class="slds-table slds-table_bordered slds-max-medium-table_stacked slds-m-bottom_small ">
        <colgroup>
          <col style="width:17.513134851138354%">
          <col style="width:82.48686514886164%">
        </colgroup>
        <thead class="slds-text-title_caps ">
          <tr class="">
            <th scope="col" class="slds-cell-wrap" style="vertical-align:top;" id="d46814e226">Error Condition</th>
            <th scope="col" class="slds-cell-wrap" style="vertical-align:top;" id="d46814e229">Description</th>
          </tr>
        </thead>
        <tbody>
          <tr class="">
            <td data-label="Error Condition" class="slds-cell-wrap" style="vertical-align:top;" headers="d46814e226 ">
              <p style="margin-bottom:0;">The user doesn’t have access to the cart.</p>
            </td>

            <td data-label="Description" class="slds-cell-wrap" style="vertical-align:top;" headers="d46814e229 ">
              <p>Error Message: You don't have access to this cart. If possible, contact the admin for
                this web store.</p>
              <p>Error Code: INSUFFICIENT_ACCESS_OR_READONLY </p>
              <p style="margin-bottom:0;">HTTP Status Code: 400</p>
            </td>

          </tr>
        </tbody>
      </table>