{"record":{"id":"c58c2c9b35fd08d3","repo":"spree/spree","slug":"calling-spree-stockreservations-extend-with-orde","errorCode":null,"errorMessage":"Calling Spree::StockReservations::Extend with order: is deprecated and will be removed in Spree 6.1. Pass cart: instead.","messagePattern":"Calling Spree::StockReservations::Extend with order: is deprecated and will be removed in Spree 6\\.1\\. Pass cart: instead\\.","errorType":"console","errorClass":null,"httpStatus":null,"severity":"warning","filePath":"spree/core/app/services/spree/stock_reservations/extend.rb","lineNumber":8,"sourceCode":"module Spree\n  module StockReservations\n    class Extend\n      prepend Spree::ServiceModule::Base\n\n      def call(cart: nil, order: nil)\n        if order\n          Spree::Deprecation.warn('Calling Spree::StockReservations::Extend with order: is deprecated and will be removed in Spree 6.1. Pass cart: instead.')\n          cart ||= order\n        end\n        return success(cart) unless Spree::StorePreferences.read(cart&.store, :stock_reservations_enabled)\n\n        expires_at = Time.current + Spree::StockReservation.ttl_for(cart)\n\n        Spree::StockReservation\n          .merge(Spree::StockReservation.for_order(cart))\n          .update_all(expires_at: expires_at, updated_at: Time.current)\n\n        success(cart)\n      end\n    end\n  end\nend\n","sourceCodeStart":1,"sourceCodeEnd":24,"githubUrl":"https://github.com/spree/spree/blob/06bf66a8684b9de03210bbb2ddc8c1f5ba522fa2/spree/core/app/services/spree/stock_reservations/extend.rb#L1-L24","documentation":"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.","triggerScenarios":"Spree::StockReservations::Extend.call(order: order) — checkout-step extensions or jobs that keep reservations alive while the shopper proceeds, written before the split.","commonSituations":"Apps with stock reservations enabled upgrading to 6.0; custom checkout timers/heartbeat code; specs extending reservations during long checkouts.","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."],"exampleFix":"# before\nSpree::StockReservations::Extend.call(order: order)\n\n# after\nSpree::StockReservations::Extend.call(cart: cart)","handlingStrategy":"validation","validationCode":"kwargs =\n  if Spree::StockReservations::Extend.instance_method(:call).parameters.any? { |_, name| name == :cart }\n    { cart: cart }\n  else\n    { order: cart }\n  end\nSpree::StockReservations::Extend.call(**kwargs)","typeGuard":"# @return [Boolean] true when Extend accepts cart:\ndef spree_reservations_extend_cart_kwarg?\n  Spree::StockReservations::Extend.instance_method(:call).parameters.any? { |_, name| name == :cart }\nend","tryCatchPattern":null,"preventionTips":["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."],"tags":["deprecation","spree","stock","reservations","keyword-argument"],"backgroundTag":"deprecated-keyword-argument","analyzedSha":"06bf66a8684b9de03210bbb2ddc8c1f5ba522fa2","analyzedAt":"2026-08-21T14:59:48.125Z","schemaVersion":2},"datasetVersion":"2026-08-21T18:17:14.833Z"}