createCart(cartInput)
Creates a cart for a buyer in a webstore.
createCart uses this Commerce API resource.
webstoreId—(Required) The ID of the webstore. The ID prefix is0ZE.version—(Required) The API version for the adapter, for example,v62.0. Without this parameter, the call doesn’t fire.cart—(Required) The cart input object. Accepts these fields:effectiveAccountId—(Optional) The effective account ID for the cart.name—(Optional) The friendly name for the cart.type—(Optional) The cart type. Valid values:Cart,PayNowReadOnly,ReadOnly,Template.currencyIsoCode—(Optional) The ISO currency code for the cart, for example,USD.
Additional fields (orderOwnerId, isSecondary, description, typeAsString, customFields) are available in API version 64.0 and later.
A Promise that resolves with a CartSummary object with these fields:
cartId—The ID of the created cart.name—The name of the cart.status—The status of the cart, for example,Active.type—The cart type.webStoreId—The ID of the webstore associated with the cart.
createCart is an imperative function, not a @wire adapter. Call it in response to a user action.
If the call fails, the Promise rejects with an error object containing an errorCode and a message.
See Also