HomeDev GuideAPI Reference
Dev GuideAPI ReferenceUser GuideGitHubNuGetDev CommunitySubmit a ticketLog In
GitHubNuGetDev CommunitySubmit a ticket

Multi-shipment examples

Describes how to work with multi-shipment, also known as split shipment, which supports shipment to multiple address in Optimizely Customized Commerce 13.

A split shipment could be a customer who buys two items, and each is shipped to a different address. During checkout, a customer can create a new address, or select from existing addresses.

If a customer purchases two or more items, the Ship to multiple addresses button appears during checkout.


During checkout, the information for each split shipping part is added. The number of split shipments is equal to the number of items in the cart, so the customer can add/select a shipping address for each item.


Upon completing the information for each split shipment, the order process moves to next step. Here, choosing a shipping delivery option, billing address, and payment is required.


Example: Creating multiple shipment for Cart base on cart's LineItem

var orderRepository = ServiceLocator.Current.GetInstance<IOrderRepository>();
    var currentMarket = ServiceLocator.Current.GetInstance<ICurrentMarket>();
    var cart = orderRepository.LoadCart(CustomerContext.Current.CurrentContactId, DefaultCartName, currentMarket);
    var form = cart.GetFirstForm();
    var cartLineItems = cart.GetAllLineItems().ToList();
    // Clean up line item in shipment
    foreach (var shipment in form.Shipments)
    // Clean up shipments
    // Adding shipment for each cart line item
    foreach (var item in cartLineItems)
        var shipment = cart.CreateShipment(_orderGroupFactory);
        var lineItem = cart.CreateLineItem(item.Code, _orderGroupFactory);
        lineItem.IsGift = item.IsGift;
        lineItem.Quantity = item.Quantity;