ccrz.ccLogicCartGetActive.createCart

Calls the ccrz.ccApiCart.create method for creating a cart record that becomes the active cart when no other candidate active carts are available.

Compatibility

This reference applies to:

Release Managed Package Version API Version
B2B Commerce for Visualforce Winter ’21 4.13 12
B2B Commerce for Visualforce Spring ’20 4.12 11
B2B Commerce for Visualforce Summer ’19 4.11 10
B2B Commerce for Visualforce Spring ’19 4.10 9
B2B Commerce for Visualforce Summer ’18 4.9 8

Signature

global virtual Map<String, Object> createCart(Map<String, Object>)

Inputs (Required)

This method accepts the Map<String, Object> from the ccrz.ccLogicCartGetActive.fetchActive method.

This method requires the following keys in the working map:

This method first checks the value of ccrz.cc_CallContext.isGuest, and executes only when the value is false.

Note

ccrz.ccApiCart.RESPONSE
Map<String, Object> that describes the status of the logic chain for this method, such as the current value of the ccrz.ccApi.SUCCESS return key.
ccrz.ccApiCart.GETACTIVE_CREATE
Boolean
Value Usage
true Create a cart record that becomes the active cart when no other candidate active carts are available.
false (default) Don't create a cart record when no other candidate active carts are available.
  • This method executes only when this key's value is true.
  • If you override this method in custom subscriber code, ensure that you never perform DML operations when this key's value is true.
  • B2B Commerce for Visualforce sets this value to true for some internal use cases, such as in the ccrz.ccApiCart.create call invoked by the ccrz.ccLogicCartAddTo.fetchCart method.

Important

ccrz.ccLogicCartGetActive.CARTID_ACTIVE
String that specifies the Salesforce ID of the active cart that the ccrz.ccLogicCartGetActive.fetchActive method determined. This method executes only when this key's value is still null, indicating that the ccrz.ccLogicCartGetActive.fetchActive method couldn't find an active cart candidate.
ccrz.ccLogicCartGetActive.CARTOWNER
String that specifies the ID of a specific user. The created cart's Owner field matches this user ID.
ccrz.ccLogicCartGetActive.CURRENCYCODE
String that specifies the currency for the cart.
ccrz.ccLogicCartGetActive.STOREFRONT
String that specifies the storefront for the cart.

Inputs (Optional)

If the working map includes the following keys, this method evaluates them:

ccrz.ccLogicCartGetActive.EFFECTIVEACCOUNT
String that specifies the ID of the selected effective account for the cart.

Outputs

This method returns the working Map<String, Object>, and sets the following keys:

ccrz.ccApi.SUCCESS
Boolean
Value Usage
true The call completed.
false The call encountered errors.

B2B Commerce for Visualforce doesn't always return an exception for any errors that can occur. When this value is false, consider rolling back the API transaction to a previous savepoint.

Tip

ccrz.ccLogicCartGetActive.CARTID_ACTIVE
String that specifies the Salesforce ID of the created cart.