ccrz.ccApiCart.price

Reprices all the items in a cart.

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

You can still call older versions of the API for this method, which can accept different input keys or return different output keys. Any differences in behavior for older versions aren't documented in this topic.

Note

Signature

global static Map<String, Object> price(Map<String, Object>)

Service Layer Classes

Logic Service Provider
ccrz.ccLogicCartPrice

Inputs (Required)

Map<String, Object> that must include the following required keys:

ccrz.ccApi.API_VERSION
The version of the B2B Commerce for Visualforce API to reference for the method call. We recommend that you use the ccrz.ccApi.CURRENT_VERSION constant whenever possible, and only reference a specific version for compatibility if necessary.

If this key isn't specified, the method returns a ccrz.ccApi.NoApiVersionException.

Note

ccrz.ccApiCart.CART_ENCID
String that specifies the encrypted cart ID to price.
ccrz.ccApiCart.CART_ID
String that specifies the cart ID to price.

Include ccrz.ccApiCart.CART_ENCID or ccrz.ccApiCart.CART_ID, but not both.

Note

Inputs (Optional)

The input map can also include the following keys:

ccrz.ccApi.API_SIZING
Map<String, Object> that describes options for sizing and scoping the method's return data. This method supports ccrz.ccApi.SZ_REFETCH => TRUE, which specifies that this method invokes ccrz.ccApiCart.fetch for returning the repriced cart.
ccrz.ccApi.SIZING => new Map<String, Object>{
    ccrz.ccApiCart.ENTITYNAME => new Map<String, Object>{
        ccrz.ccApi.SZ_REFETCH => TRUE
    }
}
ccrz.ccApiCart.CILIST
Map<String, Map<String, Object>> of the cart items to reprice. For example, when a buyer updates quantities of items in the cart, this list specifies the cart items that have changed. This map is keyed by cart item ID, and each nested Map<String, Object> defines the following subkeys:
ccrz.ccApiCart.CIQTY
Integer that specifies the item's quantity.
ccrz.ccApiCart.CICMTS
String that specifies the item's comments.
ccrz.ccApiCart.CIPREPROC
Boolean
Value Usage
true Call the ccrz.cc_api_CartExtension.preprocess extension point method for processing the cart items.
false (default) Skip the ccrz.cc_api_CartExtension.preprocess extension point method.
ccrz.ccApiCart.FORCE_PRICE_SYNC
Boolean

This input is available only in B2B Commerce for Visualforce Winter ’21 (managed package version 4.13 and API version 12).

Note

Value Usage
true Execute pricing synchronously, regardless of the value of the ccrz.ccApiCart.PRICE_ASYNC input.
false (default) Default logic determines whether to price the cart synchronously or asynchronously.
ccrz.ccApiCart.PARTIAL_CART_UPDATE
Boolean

This input is available only in B2B Commerce for Visualforce Winter ’21 (managed package version 4.13 and API version 12).

Note

Value Usage
true Apply pricing, entitlements, and quantity updates only to a certain subset of cart items. The ccrz.ccLogicCartPrice.retrieveCartData method defines the business logic for the partial update.
false (default) Execute default pricing logic.
ccrz.ccApiCart.PRICE_ASYNC
Boolean

This input is available only in B2B Commerce for Visualforce Winter ’21 (managed package version 4.13 and API version 12).

Note

Value Usage
true Execute pricing asynchronously by calling the ccrz.ccApiCart.priceAsync method.

By default, this flag is ignored for a guest buyer's cart, for partial cart updates, or when the ccrz.ccApiCart.FORCE_PRICE_SYNC input is true.

Note

false (default) Execute pricing synchronously.
ccrz.ccApiCart.SKIP_CART_PRICING
Boolean
Value Usage
true Skip the pricing logic defined in the ccrz.ccLogicCartPrice logic service provider.
false (default) Execute the pricing logic defined in ccrz.ccLogicCartPrice.
ccrz.ccApiCart.SYNC_MAX_CART_SIZE
Integer that specifies the maximum number of items that must be in a cart for synchronous processing. This value overrides the value of the Asynchronous Processing Threshold storefront configuration setting in the Cart Scale module (cs.asyncthreshold).

This input is available only in B2B Commerce for Visualforce Winter ’21 (managed package version 4.13 and API version 12).

Note

Outputs

Map<String, Object> that can include the following keys:

ccrz.ccApi.API_VERSION
Integer that indicates which API version was used for the query.
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.ccApiCart.CART_ENCID
String that specifies the encrypted ID of the cart that was priced.

If this key is empty or missing from the return data, an error likely occurred. Consider rolling back your operation.

Tip

ccrz.ccApiCart.CART_OBJLIST
List<Map<String, Object>>, where each Map<String, Object> represents an updated ccrz__E_Cart__c record that the ccrz.ccApiCart.fetch method returned.
  • This key is returned only when the input map specified ccrz.ccApi.SZ_REFETCH => true.
  • The ccrz.ccApiCart.fetch call can also return ccrz.ccApiAddress.ADDRESSLIST and ccrz.ccApiProduct.PRODUCTLIST keys. For more information about returning address and product data for a cart, see ccrz.ccApiCart.fetch.

Note