spree/spree · warning
Spree::Stock::Coordinator#shipments is deprecated and will b
Error message
Spree::Stock::Coordinator#shipments is deprecated and will be removed in Spree 6.1. Use #fulfillments instead.
What it means
Spree 6.0 renamed Shipment to Fulfillment throughout the stock layer. Stock::Coordinator#shipments — which builds one Fulfillment per package (`packages.map(&:to_fulfillment)` with the order's ship address stamped on) — is a one-release shim that warns and delegates to `fulfillments`. Removed in 6.1.
Source
Thrown at spree/core/app/models/spree/stock/coordinator.rb:20
module Stock
class Coordinator
attr_reader :order, :inventory_units
attr_accessor :unallocated_inventory_units
def initialize(order, inventory_units = nil)
@order = order
@inventory_units = inventory_units || InventoryUnitBuilder.new(order).units
end
def fulfillments
packages.map do |package|
package.to_fulfillment.tap { |fulfillment| fulfillment.address_id = order.ship_address_id }
end
end
# @deprecated Use {#fulfillments}; removed in 6.1.
def shipments
Spree::Deprecation.warn('Spree::Stock::Coordinator#shipments is deprecated and will be removed in Spree 6.1. Use #fulfillments instead.')
fulfillments
end
def packages
packages = build_packages
packages = prioritize_packages(packages)
packages = estimate_packages(packages)
end
def build_packages(packages = [])
stock_locations_with_requested_variants.each do |stock_location|
units = allocatable_units_for(stock_location)
next if units.empty?
packer = build_packer(stock_location, units)
packages += packer.packages
end
View on GitHub (pinned to 06bf66a868)
Solutions
- Replace `coordinator.shipments` with `coordinator.fulfillments`.
- If the surrounding code still talks about 'shipments' end to end, migrate the whole flow to the fulfillment vocabulary (Fulfillment model, delivery_rates, to_fulfillment) rather than renaming one call.
- Prefer routing through the standard workflows (Carts::Complete) instead of driving the Coordinator by hand, if your customization allows it.
- Update extensions to 6.0-compatible releases; silence with `Spree::Deprecation.silence { ... }` only temporarily.
Example fix
# before fulfillments = Spree::Stock::Coordinator.new(order).shipments # after fulfillments = Spree::Stock::Coordinator.new(order).fulfillments
Defensive patterns
Strategy: validation
Validate before calling
Spree::Deprecation.behavior = :raise # in spec/rails_helper.rb # audit: grep -rn "Coordinator.new.*\.shipments\|\.shipments\b" app/ lib/ spec/ | grep -v fulfillment
Prevention
- Avoid driving Stock::Coordinator directly in host code — the supported entry points are the checkout workflows, which absorb these renames for you.
- When copying stock-layer service code between Spree versions, rename the whole vocabulary (shipment/shipping → fulfillment/delivery) in one pass.
- Keep deprecations raised in test so old names fail their specs the day they're introduced.
When it happens
Trigger: Calling `Spree::Stock::Coordinator.new(order).shipments` — legacy checkout/order code, copied pre-6.0 service objects, or extensions that build fulfillments through the coordinator using the old name.
Common situations: Host apps or extensions with custom checkout flows that instantiate the Coordinator directly (instead of going through Carts::Complete) and were written against the pre-rename API; resurfaces in deprecation audits on the 6.0 upgrade.
Related errors
- Spree::Stock::Package#to_shipment is deprecated and will be
- Spree::Order#remove_out_of_stock_items! is deprecated and wi
- Spree::Order#ensure_line_items_are_in_stock is deprecated an
- Spree::Stock::Estimator#shipping_rates is deprecated and wil
- Spree::Stock::Estimator#shipping_methods is deprecated and w
AI-assisted analysis of spree/spree@06bf66a868 (2026-08-21).
Data as JSON: /api/errors/9c5e579484dd6875.
Report an issue: GitHub.