Loading
Prepare for Email to Become the Default Login ExperienceRead More
Automate Your Business Processes with Salesforce Flow
Create Cart Action

Create Cart Action

In a B2B Commerce Checkout flow, create a cart.

Required Editions

Available in: Lightning Experience
View supported editions.
Note
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).

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.

Input ParameterDescription
Web Store ID The ID of the web store.
Cart Input

This input is an Apex-defined variable of class ConnectApi.CartInput, which includes these fields:

  • 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.
  • isSecondary — (Optional) Specifies whether the cart is secondary (true) or not (false). If unspecified, defaults to false.
  • name — (Optional) Name of the cart. The name can have up to 250 Unicode characters. If unspecified, defaults to the generated name.
  • type — (Optional) Type of cart. The only valid value is Cart. If unspecified, defaults to Cart.

Store Output Values

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

Output ParameterDescription
Cart Summary

This output is an Apex-defined variable of class ConnectApi.CartSummary, which includes these fields:

  • accountId — ID of the account for the cart.
  • cartId — ID of the cart.
  • currencyIsoCode — Three-letter ISO 4217 currency code associated with the cart.
  • grandTotalAmount — Grand total amount including shipping and tax for items in the cart, in the currency of the cart.
  • isSecondary — Specifies whether the cart is secondary (true) or not (false).
  • name — Name of the cart.
  • purchaseOrderNumber — Purchase order for the cart.
  • status — Status of the cart. Possible values are:
    • Active— Cart is active.
    • Checkout— Cart is in checkout.
    • Closed— Cart is closed.
    • PendingDelete— Cart is pending deletion; for example, a user deleted the cart but the job hasn’t completed yet.
    • Processing— Cart is processing.
  • totalChargeAmount — Total amount for shipping and other charges in the currency of the cart.
  • totalListPrice — Total list price for the cart.
  • totalProductAmount — Total amount including discounts, but excluding shipping and tax, for product items in the cart.
  • totalProductAmount​AfterAdjustments — Total product amount, including promotions.
  • totalProductCount — Total count of items in the cart.
  • totalPromotional​AdjustmentAmount — Total promotional adjustment amount for items in the cart.
  • totalTaxAmount — Total tax amount for the cart, including tax on shipping, if applicable.
  • type — Type of cart. Value is always Cart.
  • uniqueProductCount — Total count of unique items, or SKUs, in the cart.
  • webstoreId — ID of the web store of the cart.

Error Conditions

Error Condition Description

The user doesn’t have access to create a 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

 
Loading
Salesforce Help | Article