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.
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:
Spree::Shipmentobject that is associated with the current order.
After the proposed shipments have been determined, the customer can continue the
checkout process and take the order from the
delivery state to the
Stock locations considered while building shipments are configurable via a Stock Locations Filter class. Since the order of stock locations is important to determine which stock items needs to be picked up first, there is also a Stock Locations Sorter class that is easily customizable as well.
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:
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
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 Solidus to contribute back to the documentation and the code.