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.cc_api_CartExtension.preprocess
Provides an extension point for evaluating any rules, requirements, or considerations
that you want to enforce before the Shopping Cart page loads or updates cart data. For example,
maybe you want to automatically add or remove items from the cart based on the cart's current
contents.
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> preprocess(Map<String, Object>)
Inputs (Optional)
Map<String, Object> that can include the following keys:
- ccrz.cc_api_CartExtension.PARAM_CART
- ccrz__E_Cart__c that represents the cart to load or update.
- ccrz.cc_api_CartExtension.PARAM_CARTITEMS
- List<ccrz__E_CartItem__c that represents the items to load or update in the cart.
- ccrz.cc_api_CartExtension.PARAM_STOREFRONT
- String that specifies the name of a storefront.
- ccrz.cc_api_CartExtension.PARAM_USERID
- ID of the user assigned to the cart:
- When an authenticated buyer is logged in, this value is the ID of their user record.
- When a customer service representative (CSR) is logged in on behalf of a buyer, this value is the buyer's user ID.
Outputs
Map<String, Object> that can include the following keys:
- ccrz.cc_api_CartExtension.PARAM_CART
- ccrz__E_Cart__c that represents the loaded or updated cart.
- ccrz.cc_api_CartExtension.PARAM_CARTITEMS
-
List<ccrz__E_CartItem__c that
represents the loaded or updated cart items. This list is the same list that you
specified in the input map, but updated with any changes that the method completed. For example:
- If you increment the quantity for some of the passed-in cart items, return the updated cart items in this key.
- If you add cart items within this method, we recommend that you include the added items in this key. However, the method doesn't strictly require that you do so.