spree/spree · warning
Calling Spree::StockReservations::Extend with order: is depr
Error message
Calling Spree::StockReservations::Extend with order: is deprecated and will be removed in Spree 6.1. Pass cart: instead.
What it means
Checkout stock reservations are keyed to the cart after the 6.0 Cart/Order split. Spree::StockReservations::Extend pushes out the expiry of a cart's reservations (returning early with success when the store has stock_reservations_enabled off); passing order: logs this warning and maps onto cart for one release. Removed in 6.1.
Source
Thrown at spree/core/app/services/spree/stock_reservations/extend.rb:8
module Spree
module StockReservations
class Extend
prepend Spree::ServiceModule::Base
def call(cart: nil, order: nil)
if order
Spree::Deprecation.warn('Calling Spree::StockReservations::Extend with order: is deprecated and will be removed in Spree 6.1. Pass cart: instead.')
cart ||= order
end
return success(cart) unless Spree::StorePreferences.read(cart&.store, :stock_reservations_enabled)
expires_at = Time.current + Spree::StockReservation.ttl_for(cart)
Spree::StockReservation
.merge(Spree::StockReservation.for_order(cart))
.update_all(expires_at: expires_at, updated_at: Time.current)
success(cart)
end
end
end
end
View on GitHub (pinned to 06bf66a868)
Solutions
- Rename the keyword: Spree::StockReservations::Extend.call(cart: cart).
- Migrate the Reserve twin (error 237) in the same sweep — both share the exact bridge shape.
- Keep relying on Spree::StockReservation.ttl_for(cart) if you compute your own expiry windows.
- Verify with deprecations raised that no call site remains.
Example fix
# before Spree::StockReservations::Extend.call(order: order) # after Spree::StockReservations::Extend.call(cart: cart)
Defensive patterns
Strategy: validation
Validate before calling
kwargs =
if Spree::StockReservations::Extend.instance_method(:call).parameters.any? { |_, name| name == :cart }
{ cart: cart }
else
{ order: cart }
end
Spree::StockReservations::Extend.call(**kwargs) Type guard
# @return [Boolean] true when Extend accepts cart:
def spree_reservations_extend_cart_kwarg?
Spree::StockReservations::Extend.instance_method(:call).parameters.any? { |_, name| name == :cart }
end Prevention
- Feature-detect once in a wrapper and reuse it for both Extend and Reserve — the bridges are identical.
- Spec reservation expiry extensions with Timecop so TTL behavior is pinned while signatures churn.
- Note the store toggle: with stock_reservations_enabled off the service returns early — don't mistake that for the keyword working.
When it happens
Trigger: Spree::StockReservations::Extend.call(order: order) — checkout-step extensions or jobs that keep reservations alive while the shopper proceeds, written before the split.
Common situations: Apps with stock reservations enabled upgrading to 6.0; custom checkout timers/heartbeat code; specs extending reservations during long checkouts.
Related errors
- Calling Spree::StockReservations::Reserve with order: is dep
- Calling Spree::Carts::RemoveOutOfStockItems with order: is d
- Spree::Order#remove_out_of_stock_items! is deprecated and wi
- Spree::Order#ensure_line_items_are_in_stock is deprecated an
- Spree::Stock::Coordinator#shipments is deprecated and will b
AI-assisted analysis of spree/spree@06bf66a868 (2026-08-21).
Data as JSON: /api/errors/c58c2c9b35fd08d3.
Report an issue: GitHub.