The class diagram below shows the specific properties and methods of the view models that support setting custom properties and splitting line items.
The CartViewModel
implements the splitItems()
function for splitting existing line items. It also includes functions for handling dynamic properties (custom properties).
The combineLineItems
string property on the CartViewModel
determines the behavior when a shopper adds instances of a SKU to a shopping cart that already contains that SKU. If combineLineItems
is set to yes
(the default), the SKUs are combined into a single line item. For example, if there is a line item with a quantity of 3 for a certain SKU, and the shopper adds that SKU to the cart again with a quantity of 2, the default behavior is to modify the existing line item, resulting in a single line item with a quantity of 5.
The splitItems()
function sets combineLineItems
to no
, to prevent merging of line items that have different customizations. In the example above, if combineLineItems
is set to no
, the result is two separate line items for the SKU, one with quantity 3 and one with quantity 2.