---
schema_version: "1"
id: 292b7a732d66d510cdc0dcd37bba5510b707eda3db137a733c2ec9996d9f6242
title: Create Cart 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_create_cart.md
canonical_url: https://help.salesforce.com/s/articleView?id=platform.flow_ref_elements_comm_actions_create_cart.htm&release=264.0.0&type=5
source_site: help.salesforce.com
content_type: documentation
content_hash: 5ebff2f4987123bc7a723cceb5faee44f70b7ba80bf791d1525b7f64b96d70a0
description: In a B2B Commerce Checkout flow, create a cart.
products:
  - Flow Builder
  - Salesforce Platform
release: "264"
---
# Create Cart Action

In a B2B Commerce Checkout flow, create 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 **Create Cart**. To access this action from REST API, use the name `createCart`.

## 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="d343393e86">Input Parameter</th>
            <th scope="col" class="slds-cell-wrap" style="vertical-align:top;" id="d343393e88">Description</th>
          </tr>
        </thead>
        <tbody>
          <tr class="">
            <td data-label="Input Parameter" class="slds-cell-wrap" style="vertical-align:top;" headers="d343393e86 "><strong class="uicontrol">Web Store ID</strong></td>
            <td data-label="Description" class="slds-cell-wrap" style="vertical-align:top;" headers="d343393e88 ">The ID of the web store.</td>
          </tr>
          <tr class="">
            <td data-label="Input Parameter" class="slds-cell-wrap" style="vertical-align:top;" headers="d343393e86 "><strong class="uicontrol">Cart Input</strong></td>
            <td data-label="Description" class="slds-cell-wrap" style="vertical-align:top;" headers="d343393e88 ">
              <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.htm" target="_blank">ConnectApi.CartInput</a>, which includes these fields:</p>
              <ul>
                <li><strong class="uicontrol">effectiveAccountId</strong> — (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.</li>
                <li><strong class="uicontrol">isSecondary</strong> — (Optional) Specifies whether the cart is
                  secondary (<kbd>true</kbd>) or not (<kbd>false</kbd>). If
                  unspecified, defaults to <kbd>false</kbd>.</li>
                <li><strong class="uicontrol">name</strong> — (Optional) Name of the cart. The name can have up to
                  250 Unicode characters. If unspecified, defaults to the generated name.</li>
                <li><strong class="uicontrol">type</strong> — (Optional) Type of cart. The only valid value is
                  <kbd>Cart</kbd>. If unspecified, defaults to
                  <kbd>Cart</kbd>.
                </li>
              </ul>
            </td>
          </tr>
        </tbody>
      </table>

## Store Output Values

Use output values later in the flow. The values are assigned when the cart 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="d343393e150">Output Parameter</th>
            <th scope="col" class="slds-cell-wrap" style="vertical-align:top;" id="d343393e152">Description</th>
          </tr>
        </thead>
        <tbody>
          <tr class="">
            <td data-label="Output Parameter" class="slds-cell-wrap" style="vertical-align:top;" headers="d343393e150 "><strong class="uicontrol">Cart Summary</strong></td>
            <td data-label="Description" class="slds-cell-wrap" style="vertical-align:top;" headers="d343393e152 ">
              <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_summary.htm" target="_blank">ConnectApi.CartSummary</a>, which includes these fields:</p>
              <ul>
                <li><strong class="uicontrol">accountId</strong> — ID of the account for the cart.</li>
                <li><strong class="uicontrol">cartId</strong> — ID of the cart.</li>
                <li><strong class="uicontrol">currencyIsoCode</strong> — Three-letter ISO 4217 currency code
                  associated with the cart.</li>
                <li><strong class="uicontrol">grandTotalAmount</strong> — Grand total amount including shipping
                  and tax for items in the cart, in the currency of the cart.</li>
                <li><strong class="uicontrol">isSecondary</strong> — Specifies whether the cart is secondary
                  (<kbd>true</kbd>) or not (<kbd>false</kbd>).</li>
                <li><strong class="uicontrol">name</strong> — Name of the cart.</li>
                <li><strong class="uicontrol">purchaseOrderNumber</strong> — Purchase order for the cart.</li>
                <li><strong class="uicontrol">status</strong> — Status of the cart. Possible values are:<ul>
                    <li><kbd>Active</kbd>— Cart is active.</li>
                    <li><kbd>Checkout</kbd>— Cart is in checkout.</li>
                    <li><kbd>Closed</kbd>— Cart is closed.</li>
                    <li><kbd>PendingDelete</kbd>— Cart is pending deletion; for example, a
                      user deleted the cart but the job hasn’t completed yet.</li>
                    <li><kbd>Processing</kbd>— Cart is processing.</li>
                  </ul>
                </li>
                <li><strong class="uicontrol">totalChargeAmount</strong> — Total amount for shipping and other
                  charges in the currency of the cart.</li>
                <li><strong class="uicontrol">totalListPrice</strong> — Total list price for the cart.</li>
                <li><strong class="uicontrol">totalProductAmount</strong> — Total amount including discounts, but
                  excluding shipping and tax, for product items in the cart.</li>
                <li><strong class="uicontrol">totalProductAmount​AfterAdjustments</strong> — Total product amount,
                  including promotions.</li>
                <li><strong class="uicontrol">totalProductCount</strong> — Total count of items in the cart.</li>
                <li><strong class="uicontrol">totalPromotional​AdjustmentAmount</strong> — Total promotional
                  adjustment amount for items in the cart.</li>
                <li><strong class="uicontrol">totalTaxAmount</strong> — Total tax amount for the cart, including
                  tax on shipping, if applicable.</li>
                <li><strong class="uicontrol">type</strong> — Type of cart. Value is always
                  <kbd>Cart</kbd>.
                </li>
                <li><strong class="uicontrol">uniqueProductCount</strong> — Total count of unique items, or SKUs,
                  in the cart.</li>
                <li><strong class="uicontrol">webstoreId</strong> — ID of the web store of 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="d343393e287">Error Condition</th>
            <th scope="col" class="slds-cell-wrap" style="vertical-align:top;" id="d343393e290">Description</th>
          </tr>
        </thead>
        <tbody>
          <tr class="">
            <td data-label="Error Condition" class="slds-cell-wrap" style="vertical-align:top;" headers="d343393e287 ">
              <p style="margin-bottom:0;">The user doesn’t have access to create a cart.</p>
            </td>

            <td data-label="Description" class="slds-cell-wrap" style="vertical-align:top;" headers="d343393e290 ">
              <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>