Class: Spree::OrderRouting::Strategy::Legacy

Inherits:
Base
  • Object
show all
Defined in:
app/models/spree/order_routing/strategy/legacy.rb

Overview

Pre-5.5 routing behavior. Delegates to Spree::Stock::Coordinator, which packs every active stock location and lets Prioritizer’s Adjuster distribute units across the resulting packages — no rules consulted, no merchant-driven preferences, location order is whatever the database returns.

Provided as an opt-in escape hatch for merchants upgrading from 5.4 who are not ready to adopt rules-based routing. Configure via:

store.update!(preferred_order_routing_strategy: 'Spree::OrderRouting::Strategy::Legacy')

Spree 6.0 drops this strategy along with the underlying Coordinator. See docs/plans/6.0-order-routing.md.

Instance Attribute Summary

Attributes inherited from Base

#order

Instance Method Summary collapse

Methods inherited from Base

display_name, #initialize

Constructor Details

This class inherits a constructor from Spree::OrderRouting::Strategy::Base

Instance Method Details

#for_allocationObject



18
19
20
# File 'app/models/spree/order_routing/strategy/legacy.rb', line 18

def for_allocation
  Spree::Stock::Coordinator.new(order).packages
end

#for_cancellationObject



29
# File 'app/models/spree/order_routing/strategy/legacy.rb', line 29

def for_cancellation; end

#for_releaseObject



28
# File 'app/models/spree/order_routing/strategy/legacy.rb', line 28

def for_release; end

#for_sale(fulfillment:) ⇒ Object

Stock decrement / restock today happens via Spree::Shipment’s state machine (after_ship / after_cancel). The strategy hooks below are part of the contract for the future reservation + typed-movement phase. In 5.5 they are no-ops; existing model callbacks already do the right thing.



27
# File 'app/models/spree/order_routing/strategy/legacy.rb', line 27

def for_sale(fulfillment:); end