aws-samples / retail-demo-store

AWS Retail Demo Store is a sample retail web application and workshop platform demonstrating how AWS infrastructure and services can be used to build compelling customer experiences for eCommerce, retail, and digital marketing use-cases
MIT No Attribution
726 stars 515 forks source link

Cart Issue : Items added to the cart while signed in will be refreshed when you sign out and then sign back in. #576

Open kashinoki38 opened 6 months ago

kashinoki38 commented 6 months ago

Items added to the cart while signed in will be refreshed when you sign out and then sign back in.

Reproduce with the following steps:

  1. Sigin in the User
  2. Put some items in a cart
  3. Sign out User
  4. Sign in same User
  5. See the cart -> there is no items which was put on step2

Cause:

On the step3 (Sign out User), cart will be newly created as guest user. On the step4 newly created cart will be used for signed in user.

Ideal behavior:

On the step4,

TotalLag commented 1 month ago

Commenting as this is an interesting issue I'd like to try taking on. The general concept of cart persistence and merging across guest and logged-in sessions is a common feature in modern e-commerce.

Issue:

We need to define and implement the expected behavior for the shopping cart when users interact with it across different states: as guests, logged-in users, and when transitioning between these states (e.g., adding items as a guest and then logging in, or logging out while having items in the cart).

Acceptance Criteria:

  1. Cart Merging Logic: Ensure that when a user logs in after using a guest cart, the items in both carts are merged, with quantity updates for duplicate items.
  2. Persistent Cart Across Devices: Investigate and potentially implement a feature to keep the cart synchronized across multiple devices and browsers when users log in or out.
  3. Guest Cart Expiry: Define how long guest carts should persist in case the session is inactive and how to handle cart expiry gracefully.