ruby-on-railsruby-on-rails-4devisespreespree-auth-devise

Spree shopping cart being replaced instead of merged upon user sign in


Using Spree 3.0.8

When I perform the sequence:

  1. add items to the shopping cart as a guest user (not signed in);
  2. proceed to checkout (which prompts for a sign in);
  3. sign in

My shopping cart is essentially replaced by the most recent incomplete order from the user that signed in.

I would expect that both guest and incomplete order be merged. At least it seems to be the intention in spree_auth_devise's code.

Does anybody have a clue on why this might be happening?

Cheers, Vasco.


Solution

  • Apparently, this was introduced in this commit: https://github.com/spree/spree_auth_devise/commit/336b0e4f3a9c38dba36c8deef37549f48f61672f

    While the above commit solves https://github.com/spree/spree/issues/6578, it also discards the guest user's shopping cart since there is no email associated.

    I reverted to the old code and the problem is solved (at the expense of introducing issue #6578 which, in my case, is not applicable).