Note: This release is in preview. Features described here don’t become generally available until the latest general availability date that Salesforce announces for this release. Before then, and where features are noted as beta, pilot, or developer preview, we can’t guarantee general availability within any particular time frame or at all. Make your purchase decisions only on the basis of generally available products and features.

ccrz.ccLogicCartPriceAsync.prepareCartItems

Identifies ccrz__E_CartItem__c records to pass to or exclude from the subsequent pricing methods. This method executes only during the recursive, asynchronous ccrz.ccApiCart.priceAsync method calls.

Compatibility

This reference applies to:

Release Managed Package Version API Version
B2B Commerce for Visualforce Winter ’21 4.13 12

Signature

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

Inputs (Required)

This method accepts the Map<String, Object> after the ccrz.ccLogicCartPriceAsync.retrieveCartItems method completes.

This method requires the following keys in the working map:

ccrz.ccLogicCartPriceAsync.CART_ITEM_LIST
List<ccrz__E_CartItem__c> that contains the major and minor line items to evaluate.
ccrz.ccLogicCartPriceAsync.CART_TO_PRICE
ccrz__E_Cart__c record that represents the cart to price.

Outputs

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

'attributes'
Set<String> of attribute IDs, populated from each cart item's ccrz__PrimaryAttr__c, ccrz__SecondaryAttr__c, and ccrz__TertiaryAttr__c fields.
ccrz.ccLogicCartPriceAsync.EXTERNALLY_PRICED_ITEMS
List<ccrz__E_CartItem__c> of the items where ccrz__PricingType__c is external. These items are excluded from the subsequent pricing methods.
ccrz.ccLogicCartPriceAsync.ITEMS_TO_DELETE
List<ccrz__E_CartItem__c> of the items to remove from the working map. By default, this method adds a cart item to this list when the item meets any of the following criteria:
  • The cart item's quantity changed to 0.
  • The cart item's ccrz__ProductType__c field has the value Coupon.
ccrz.ccLogicCartPriceAsync.ITEMS_TO_PRICE
List<ccrz__E_CartItem__c> of the items to pass to subsequent pricing methods. For each cart item, this method updates the values of the following fields:
ccrz__E_CartItem__c Field Value
ccrz__ItemStatus__c Available
ccrz__Price__c -1

This value is an initial value. The inner methods of ccrz.ccLogicCartPriceAsync.applyPricing evaluate each cart item and update this value.

Note

ccrz.ccLogicCartPriceAsync.MAJORS_WITH_EXTERNAL_CHILDREN
List<String> of cart item IDs that are major line items with child cart items where ccrz__PricingType__c is external. These items are excluded from the subsequent pricing methods.
ccrz.ccLogicCartPriceAsync.PRICING_INPUT_MAP
Map<String, Object> of input data for a ccrz.ccApiProduct.fetch query, which the ccrz.ccLogicCartPriceAsync.fetchPricingData method executes. This map includes:
  • Available data from other return data keys—such as 'products', 'attributes', 'sellers', and 'spts'—which specify parameters for the fetch query.
  • The key value ccrz.ccApiProduct.PARAM_INCLUDE_PRICING => true, which ensures that the fetch query returns ccrz.ccApiProduct.PRODUCTPRICINGDATA and ccrz.ccApiAttribute.IDS, if applicable.
'products'
Set<String> of product IDs, populated from each cart item's ccrz__Product__c field.
'sellers'
Set<String> of seller IDs, populated from each cart item's ccrz__Seller__c field.
'spts'
Set<String> of subscription term IDs, populated from each cart item's ccrz__SubProdTerm__c field.