1. Chris Moffitt
  2. satchmo
  3. Issues
Issue #1204 open

Persistent Cart - Overriding current cart

Dinh Bowman
created an issue

I ran into the problem where if a user has an empty cart and is shopping while not logged in: once logging in, his current cart is overwritten with the empty cart.

I don't believe this is the intended behavior and I also don't necessarily agree that retrieving an old persistent cart should always merge with a non-empty current cart.

I modified a few files to address this issue and have attached a diff. I'm not entirely sure that the Cart.merge_carts() needed me to add a self.save() but I did anyways and it is in the patch.

Comments (4)

  1. Hynek Cernoch

    Thanks to Bruce. The fix is fixed by a5bd2a536309 .

    The variable PERSISTENT_CART_MERGE is not much helpful. Usefulness of Yes/No does not depend on the shop, but on the user's conditions. Has he repeated product selection yet or has he forgotten, what was in the cart? User should be informed about the merge. The best solution would be to ask the user, if he want to merge carts. ("Do you want to add 3 products for total $123.00 from your old cart?" Yes/No).

    This is not much important.

  2. scrapper

    Hello Bruce, i am sorry for reopening, but i haven't got response from the mailing list nor from satchmo IRC channel.

    Cart merging does not work for me, is it working for you? The new cart overwrites the saved cart... this works. But when i try to do cart merging, both get deleted. And the following message is presented to the user: Your cart is empty.

    Maybe this is only not working for me and i have messed up with my code.

    So thank you guys, thank you Bruce (or Chris or anybody) for your reply!

    greetings sc

  3. Log in to comment