ccrz.ccApiCart.createCartItemGroup
Creates a shipping group of cart items for line-level independence (LLI)
checkout.
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 static Map<String, Object> createCartItemGroup(Map<String, Object>)
Service Layer Classes
- Logic Service Provider
- ccrz.ccLogicCartCreateCartItemGroup
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.
- 'ECartItemGroupsS'
- List<Map<String, Object>>, where each Map<String, Object> represents the ccrz__E_CartItemGroup__c record to create. This map can specify subkeys for field values to set on the cart item group record. For a list of fields, see the ccrz__E_CartItemGroup__c reference.
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 updated
cart.
ccrz.ccApi.SIZING => new Map<String, Object>{ ccrz.ccApiCart.ENTITYNAME => new Map<String, Object>{ ccrz.ccApi.SZ_REFETCH => TRUE } }
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. - ccrz.ccApiCart.CART_OBJLIST
- List<Map<String, Object>>, where the Map<String, Object> represents the updated ccrz__E_Cart__c record.
- ccrz.ccApiCart.ITEMGROUPID
- String that specifies the Salesforce ID of the created cart item group.
Example
Create a cart item group from input values.
Boolean wasSuccessful = false;
Date requestedDate = date.today();
Map<String, Object> cartItemGroupToCreate = new Map<String, Object> {
'cart' => 'cartID'
'note' => 'Text for the shipping note',
'requestedDate' => requestedDate,
'shipTo' => 'contactAddressID',
'shipAmount' => '20.00',
'shipMethod' => 'Ground'
};
Map<String, Object> cartItemGroupCreateInputData = new Map<String, Object> {
ccrz.ccApi.API_VERSION => ccrz.ccApi.CURRENT_VERSION,
'ECartItemGroupsS' => new List<Map<String, Object>> {cartItemGroupToCreate}
};
try {
Map<String, Object> createCartItemGroupResults = ccrz.ccApiCart.createCartItemGroup(cartItemGroupCreateInputData);
wasSuccessful = (Boolean)createCartItemGroupResults.get(ccrz.ccApi.SUCCESS);
String newItemGroupId = (String) createCartItemGroupResults.get(ccrz.ccApiCart.ITEMGROUPID);
// Do something with the created cart item group
} catch (Exception e) {
// Error handling...
}