Share via


How Shipments Are Created

Commerce Server Core Systems creates shipments based on shipping method and shipping address information that you collect from the user.

From your site code, you ask the user which items to ship to which address, and which shipping method to use. You then set the ShippingMethodId and ShippingAddressId properties of each LineItem object in the user's basket.

The Total pipeline uses this information to create Shipment objects and adds them to the OrderForm object. Each Shipment object references a set of line items, an address, and a shipping method.

How the Commerce Server Core System Creates Shipments

When you run the Total pipeline, Commerce Server Core Systems uses the information that you added to the LineItem objects to create Shipment objects. The following three pipeline components play a role in creating shipments:

The Splitter pipeline component examines all the items in the basket, and groups the line items according to the shipping address and the shipping method. It then creates one Shipment object for each group of line items, and sets the following properties of each Shipment object:

For example, consider a basket that contains four line items that will be shipped to two addresses by using two shipping methods, as shown in the following table.

Line Item

Shipping Address

Shipping Method

A

Home

Ground

B

Home

Air

C

Work

Ground

D

Home

Ground

The Splitter pipeline component will create three shipments for this basket, as shown in the following table:

Shipment

Line Items

Shipping Address

Shipping Method

1

A, D

Home

Ground

2

B

Home

Air

3

C

Work

Ground

Note

By default, the Splitter pipeline component groups line items based on the ShippingAddressId and ShippingMethodId properties. However, you can configure the Splitter component to group the line items according to custom properties such as weight and quantity.

After the Splitter pipeline component creates the Shipment objects, the ShippingMethodRouter pipeline component identifies and invokes the correct pipeline component to calculate the cost of each shipment. The pipeline components that calculate the shipping costs are called shipping cost calculators.

The only shipping cost calculator that Commerce Server Core Systems includes is the StepwiseShipping pipeline component. The StepwiseShipping pipeline component calculates the cost of a shipment based on the cost of the items, the quantity of the items, or the combined weight of the items.

Note

Use the Customer and Orders Manager to specify whether the StepwiseShipping pipeline component should calculate the shipment cost based on subtotal, quantity, or weight.

Note

You can create a custom shipping cost calculator by creating a new pipeline component and by using the Customer and Orders Manager to associate the new component with a shipping method.

See Also

Other Resources

Orders Runtime Object Model

How to Set the ShippingMethodId for a LineItem

What is the Lifecycle of an Order?

Shipping Objects

Working with Baskets