Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cart is persistent across different user login/logout, tough sharing pricing/voucher #54

Open
AlexDigital974 opened this issue Jul 29, 2022 · 8 comments

Comments

@AlexDigital974
Copy link

AlexDigital974 commented Jul 29, 2022

Bug report

Describe the bug

1)I login with a user i add product to my cart . I may or may not apply a voucher-discount or even add a price list.

  1. i logout or switch user

  2. i still have the cart with the voucher/pricelist(bypassing the pricelist restriction)

Additional context

Expected behavior

If i logout, or switch user my cart should be different and link to that user especially if pricing or voucher where used.

@AlexDigital974 AlexDigital974 changed the title Cart is persistent across different user login/logout, which is not good when pricelist/voucher/ or in general Cart is persistent across different user login/logout, tough sharing pricing/voucher Jul 29, 2022
@winston0410
Copy link

+1 I notice this issue as well. And there seems not to be an endpoint that get the last cart of a customer, nor Medusa handle that automatically

@wildan-m
Copy link

Have you found any workaround?

@VariableVic
Copy link
Collaborator

This is due to the _medusa_cart_id cookie persisting after logout. If you want the cart to reset after logout, add the following line to the signOut Server Action in src/modules/account/actions.ts:

cookies().set("_medusa_cart_id", "", { maxAge: -1, })

Would you guys expect this to be the default behaviour?

@wildan-m
Copy link

@VariableVic In my case the users don't even log in, they share filled address info across devices and browsers. How can we sign out if the users are not logged in? It works fine when they are logged in.

@VariableVic
Copy link
Collaborator

@wildan-m Then I didn't understand your issue correctly. OP mentioned that the cart persists after logging out or switching accounts, which is correct and by design.

What is the exact issue you're facing? Please provide detailed steps on how to reproduce.

@wildan-m
Copy link

wildan-m commented Feb 13, 2024

@VariableVic Some of the information in this section (usually email) can be seen by other visitors and auto-filled, even when they are using different browsers/devices. This happens when users are not in a logged-in state. The weird behavior does not occur when using localhost, but when deployed to the server, it occurs.

I use the Ubuntu server with pm2 to start the node.

Screenshot 2024-02-13 at 22 40 08

@sumanchy88
Copy link

@wildan-m Have you found any solution for above issue? I'm facing similar issue.

@wildan-m
Copy link

@sumanchy88 Not resolved yet, my client understands that the issue does not come from my customization, so he just lets it go.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants