The class diagram below shows the properties and methods added to the view models to support multiple shipping groups. Detailed descriptions of these APIs follow the diagram.

This illustration is described in the surrounding text.
CartViewModel.isSplitShipping

The property that indicates if split shipping is activated. When the shopper chooses the split shipping option, this property must be set to true. You should also use this property to control the visibility of split shipping/single shipping UI elements.

ShippingGroupRelationship

The view model class that represents an association between a cart item and a shipping group. Strictly speaking, shipping group relationships associate a specified quantity of a cart item with a shipping address and shipping method (not a shipping group). However, the shipping groups array that supports split shipping is directly generated from the ShippingGroupRelationship instances. When the shopper selects a shipping address and shipping method for a quantity of a given cart item, it is this class that captures those selections. See Understand REST support for split shipping for more details on the shipping groups array.

CartItem.shippingGroupRelationships

The collection of ShippingGroupRelationship instances for a cart item. By default, there is one ShippingGroupRelationship instance per cart item, meaning that each cart item will be associated with at least one shipping group.

CartItem.addShippingGroupRelationship

In order to ship the same cart item (SKU) to several different addresses (shipping groups), it is necessary to create several associations (shipping group relationships) between a cart item and the different shipping groups. This method creates additional shipping group relationship instances, allowing multiple associations per single cart item. The maximum number of shipping group relationship instances is equal to the cart item quantity, beyond which it is not possible to split the cart item any further (as there would be more associations than cart items available).

CartItem.canAddShippingGroupRelationship

Determines if it is possible to add another shipping group relationship instance (that is, associate the cart item with another shipping group). The maximum number of shipping group relationship instances is equal to the cart item quantity, beyond which it is not possible to split the cart item any further (as there would be more associations than cart items available).

CartItem.removeShippingGroupRelationship

Removes a ShippingGroupRelationship instance from the cart item’s shippingGroupRelationships array.

CartViewModel.hasSingleShippingInformation

When in single shipping mode (that is, isSplitShipping is false), determines if the single shipping address and shipping method are populated.

CartViewModel.hasSplitShippingInformation

When in split shipping mode (that is, isSplitShipping is true), determines if all shipping group relationships are populated with shipping addresses and shipping methods, and the shippingGroupRelationships array is valid. See ShippingGroupsRelationships array validation for details.

CartViewModel.hasShippingInformation

This property is true if either hasSplitShippingInformation or hasSingleShippingInformation is true, otherwise it is false.

CartViewModel.priceCartForCheckout

The method that calls the Store priceOrder endpoint to price the shopping cart only if the cart has shipping information; that is, hasShippingInformation is true. This method’s internal logic accounts for both single and split shipping scenarios.

CartViewModel.orderShippingGroups

The latest shipping groups array (if any) returned from a web service call. See Understand REST support for split shipping for more details on this array


Copyright © 1997, 2016 Oracle and/or its affiliates. All rights reserved. Legal Notices