diff --git a/lib/spree/core/controller_helpers/order.rb b/lib/spree/core/controller_helpers/order.rb index e95499bef2..fe99381c7f 100644 --- a/lib/spree/core/controller_helpers/order.rb +++ b/lib/spree/core/controller_helpers/order.rb @@ -68,18 +68,9 @@ module Spree session[:guest_token] = nil end - # Recover incomplete orders from other sessions after logging in. + # Load current order and create a new one if necessary. def set_current_order - return unless (user = spree_current_user) - - last_incomplete_order = user.last_incomplete_spree_order - - if session[:order_id].nil? && last_incomplete_order - session[:order_id] = last_incomplete_order.id - end - - # Load current order and create a new one if necessary. - current_order(true) + current_order(true) if spree_current_user end def current_currency diff --git a/spec/controllers/base_controller_spec.rb b/spec/controllers/base_controller_spec.rb index fb1d399335..e68e10e0c2 100644 --- a/spec/controllers/base_controller_spec.rb +++ b/spec/controllers/base_controller_spec.rb @@ -28,17 +28,6 @@ describe BaseController, type: :controller do expect(user.orders.count).to eq 1 end - it "uses the last incomplete order" do - last_cart = create(:order, user: user, created_by: user, state: "cart", completed_at: nil) - allow(controller).to receive(:spree_current_user).and_return(user) - - expect { - get :index - }.to_not change { Spree::Order.count } - - expect(session[:order_id]).to eq last_cart.id - end - it "ignores the last incomplete order" do # Spree used to merge the last order with the current one. # And we used to override that logic to delete old incomplete orders.