spree-multi-domain
spree-multi-domain copied to clipboard
Cart shared between domains?
It's ok that the Cart is shared between different domains? I don't know if this is the default behavior or is a bug.
In any case, is there a way to have independent shopping carts between different domains?
Thanks!
Well i found out how to do this, so if anyone is stuck with the same problem, here is what I did.
I just made a decorator of the set_current_order method in Spree::Core::ControllerHelpers::Order module.
module Spree
module Core
module ControllerHelpers
module Order
def set_current_order
if user = try_spree_current_user
last_incomplete_order = user.spree_orders.incomplete.where(:created_by_id => user.id, store_id: current_store.id).order('created_at DESC').first
if session[:order_id].nil? && last_incomplete_order
session[:order_id] = last_incomplete_order.id
elsif current_order && last_incomplete_order && current_order != last_incomplete_order
current_order.merge!(last_incomplete_order, user)
end
end
end
end
end
end
end
@imella This just happened to us. Do you know how you were able to reproduce that behavior?