mirror of
https://github.com/openfoodfoundation/openfoodnetwork
synced 2026-03-12 03:50:22 +00:00
Remove unreachable order recovery code
Every page load creates a cart order if none is present. So when a user logs in, they always have an order stored in their session. And therefore, we never got to recover an old order. We could have fixed the code to restore old orders. But as far as I can tell, order recovery hasn't been working for years and I couldn't find any issue requesting this feature. If we wanted to implement order recovery, it should probably be designed more carefully and included in the `current_order` method.
This commit is contained in:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user