Retaining shipping group information
Commerce’s default behavior is to reset shipping group relationships whenever the shopper makes changes to the cart.
![]()
This section applies to Storefront Classic only.
You may want to override this behavior to retain shipping group information for the shopper so he does not have to re-enter it when he resumes the checkout process.
To avoid resetting shipping group relationships, you can use an application-level JavaScript module that configures the resetShippingGroupRelationships flag. Specifically, you must create an extension that uploads an application-level JavaScript module that depends on the cc-store-configuration-1.0.js library and sets the resetShippingGroupRelationships flag to false. The following code sample shows what the contents of this JavaScript module might look like (for general information on creating an application-level JavaScript extension, see Understand widgets):
define(
//-------------------------------------------------------------------
// DEPENDENCIES
//-------------------------------------------------------------------
['ccStoreConfiguration'],
//-------------------------------------------------------------------
// Module definition
//-------------------------------------------------------------------
function(CCStoreConfiguration) {
"use strict";
return {
// Override the default value (true) of resetShippingGroupRelationships to
// false to retain shipping group relationship on cart updates
CCStoreConfiguration.getInstance().resetShippingGroupRelationships = false;
};
});