Open matiasstanghelini opened 2 weeks ago
I'm encountering an issue during the checkout process where the customer_id can’t be associated with the cart. In @medusajs/types, the HttpTypes.StoreUpdateCart interface doesn’t have a customer_id field. As a result, when the customer completes the order, it isn’t associated with their customer_id—instead, a guest customer is created, as if the user wasn’t logged in.
I've been troubleshooting this, initially thinking it was an issue with my storefront code, but it now seems that the problem might lie with the Medusa HttpTypes.StoreUpdateCart interface.
I am also having this issue. Since I am very new to this project, I also thought my code was at fault, but this is also faulty in the starter theme from Medusa.
I am having the same issue , for me when even if i am logged in, it will create a new guest user and link the new order with that and i am not able to list those order on order page
There are two issues being described here:
Regarding the former, you can read about the behavior we will introduce here.
Package.json file
Node.js version
v20.17.0
Database and its version
PostgresSQL 16
Operating system name and version
Windows 10
Browser name
Chrome
What happended?
We identified a bug in Medusa.js v2.0 where creating an account with an email previously used for a guest order leads to duplicate customer records in the customer table. This causes issues with order visibility, as users cannot see their past guest orders after registering.
Comment When a user places an order as a guest using a specific email address (e.g., user@example.com) and later registers with the same email, Medusa creates two separate customer records:
This results in two distinct accounts with the same email. Orders made as a guest are linked to the guest account, making them inaccessible when the user logs in with their newly registered account. This fragmented data leads to a poor user experience, as customers expect to view all their orders upon logging in.
Expected behavior
When a user registers using an email associated with a previous guest order, Medusa should:
Actual behavior
Medusa creates two separate entries in the customer table:
Link to reproduction repo
-