Solidus supports split shipments out of the box. This feature addresses the needs of complex Solidus stores who require detailed inventory management, and sophisticated shipping and warehouse logic. It also allows you to manage shipments from multiple stock locations.
contains all of the
business logic for how stock should be packaged. If your store requires a
specialized flow for handling split shipments, the simple coordinator should
provide a good starting point for customizations.
Creating proposed shipments
An order's shipments are determined by
Spree::Order's' state is set to
delivery. This occurs before the customer
has completed their order at checkout.
SimpleCoordinator takes an order and builds as many shipments as are
necessary to fulfill it.
The simple coordinator performs a number of tasks in order to create shipment proposals:
- The coordinator checks the availability of the ordered items.
- Inventory is allocated from available stock to the current order.
- It splits the order into logical packages based on stock locations and inventory at those locations.
- Each package generates a new
Spree::Shipmentobject that is associated with the current order.
- It estimates the shipping rates for each shipment.
After the proposed shipments have been determined, the customer can continue the
checkout process and take the order from the
delivery state to the
In order to split shipments, Solidus runs a series of splitters in sequence. The first splitter in the sequence takes the array of packages from the order, splits the order into packages according to its rules, then passes the packages on to the next splitter in the sequence.
For each generated shipment, a shipping method can be assigned.
Solidus comes with three built-in splitters:
- Backordered splitter : Splits an order based on the amount of inventory on hand at each stock location.
- Shipping category splitter : Splits an order into shipments based on a product's shipping categories. This means that each package only has items that belongs to the same shipping category.
: Splits an order into shipments based on a
weight threshold. This means that each shipment has a maximum weight: if a new
item is added to the order and it causes a package to go over the weight
threshold, a new shipment is created. Each shipment needs to weigh less than
the threshold. You can set the weight threshold by changing the
Spree::Stock::Splitter::Weight.thresholdvalue in an initializer. (It defaults to
Note that splitters can be customized. Create you own splitter by inheriting the
For an example of a simple splitter, take a look at Solidus's
. This splitter ensures that items that weigh
150 are split into their own shipment.
After you create your splitter, you need to add it to the array of splitters
that Solidus uses. To do this, add the following to your
Rails.application.config.spree.stock_splitters << Spree::Stock::Splitter::CustomSplitter
You can also override the splitters used in Solidus, rearrange them, or
otherwise customize them from the
Rails.application.config.spree.stock_splitters = [ Spree::Stock::Splitter::CustomSplitter, Spree::Stock::Splitter::ShippingCategory ]
If you want to add different splitters for each of your
you can decorate the
Spree::Stock::SimpleCoordinator class and override the
Turn off split shipments
If you don't want to split packages in any case, you can set the
config.spree.stock_splitters option to an empty array:
Rails.application.config.spree.stock_splitters = 
Solidus is an open source platform supported by the community. We encourage everyone using Solius to contribute back to the documentation and the code.