Skip to content

Commit 713dbe4

Browse files
authored
docs: add section on customer account deletion (medusajs#13048)
1 parent 4da237f commit 713dbe4

File tree

3 files changed

+65
-5
lines changed

3 files changed

+65
-5
lines changed

www/apps/book/public/llms-full.txt

Lines changed: 32 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23274,9 +23274,39 @@ When this or another guest customer registers an account with the same email, a
2327423274

2327523275
## Email Uniqueness
2327623276

23277-
The above behavior means that two `Customer` records may exist with the same email. However, the main difference is the `has_account` property's value.
23277+
The above behavior means that two `Customer` records may exist with the same email address. However, the main difference is the `has_account` property's value.
2327823278

23279-
So, there can only be one guest customer (having `has_account=false`) and one registered customer (having `has_account=true`) with the same email.
23279+
So, there can only be one guest customer (having `has_account=false`) and one registered customer (having `has_account=true`) with the same email address.
23280+
23281+
***
23282+
23283+
## Customer Deletion and Email Reuse
23284+
23285+
When a merchant deletes a customer, the `Customer` record is soft-deleted, meaning it is not permanently removed from the database.
23286+
23287+
When using the Medusa Application with the [Auth Module](https://docs.medusajs.com/Users/shahednasser/medusa/www/apps/resources/app/commerce-modules/auth/index.html.md), possible confusion may arise in the following scenarios:
23288+
23289+
1. An admin user is using the email address `[email protected]`, and a customer tries to register with the same email address.
23290+
2. An admin user has deleted a customer with the email address `[email protected]`, and another customer tries to register with the same email address.
23291+
23292+
In these and similar scenarios, the customer trying to register will receive an error message indicating that the email address is already in use:
23293+
23294+
```json
23295+
{
23296+
"type": "unauthorized",
23297+
"message": "Identity with email already exists"
23298+
}
23299+
```
23300+
23301+
To resolve this, you can amend the registration flow to:
23302+
23303+
1. Retrieve the login token of the existing identity with the same email address.
23304+
2. Use the login token when registering the new customer. This will not remove the existing identity but will allow the new customer to register with the same email address.
23305+
23306+
You can learn more about how to implement this flow in the following guides:
23307+
23308+
- [Conceptual guide on how to implement this flow with Medusa's authentication routes](https://docs.medusajs.com/Users/shahednasser/medusa/www/apps/resources/app/commerce-modules/auth/authentication-route#handling-existing-identities/index.html.md).
23309+
- [How-to guide on how to implement this in a storefront](https://docs.medusajs.com/Users/shahednasser/medusa/www/apps/resources/app/storefront-development/customers/register/index.html.md).
2328023310

2328123311

2328223312
# Links between Customer Module and Other Modules

www/apps/resources/app/commerce-modules/customer/customer-accounts/page.mdx

Lines changed: 32 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,36 @@ When this or another guest customer registers an account with the same email, a
2424

2525
## Email Uniqueness
2626

27-
The above behavior means that two `Customer` records may exist with the same email. However, the main difference is the `has_account` property's value.
27+
The above behavior means that two `Customer` records may exist with the same email address. However, the main difference is the `has_account` property's value.
2828

29-
So, there can only be one guest customer (having `has_account=false`) and one registered customer (having `has_account=true`) with the same email.
29+
So, there can only be one guest customer (having `has_account=false`) and one registered customer (having `has_account=true`) with the same email address.
30+
31+
---
32+
33+
## Customer Deletion and Email Reuse
34+
35+
When a merchant deletes a customer, the `Customer` record is soft-deleted, meaning it is not permanently removed from the database.
36+
37+
When using the Medusa Application with the [Auth Module](../../auth/page.mdx), possible confusion may arise in the following scenarios:
38+
39+
1. An admin user is using the email address `[email protected]`, and a customer tries to register with the same email address.
40+
2. An admin user has deleted a customer with the email address `[email protected]`, and another customer tries to register with the same email address.
41+
42+
In these and similar scenarios, the customer trying to register will receive an error message indicating that the email address is already in use:
43+
44+
```json
45+
{
46+
"type": "unauthorized",
47+
"message": "Identity with email already exists"
48+
}
49+
```
50+
51+
To resolve this, you can amend the registration flow to:
52+
53+
1. Retrieve the login token of the existing identity with the same email address.
54+
2. Use the login token when registering the new customer. This will not remove the existing identity but will allow the new customer to register with the same email address.
55+
56+
You can learn more about how to implement this flow in the following guides:
57+
58+
- [Conceptual guide on how to implement this flow with Medusa's authentication routes](../../auth/authentication-route/page.mdx#handling-existing-identities).
59+
- [How-to guide on how to implement this in a storefront](../../../storefront-development/customers/register/page.mdx).

www/apps/resources/generated/edit-dates.mjs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ export const generatedEditDates = {
1616
"app/commerce-modules/currency/page.mdx": "2025-04-17T08:48:30.550Z",
1717
"app/commerce-modules/customer/_events/_events-table/page.mdx": "2024-07-03T19:27:13+03:00",
1818
"app/commerce-modules/customer/_events/page.mdx": "2024-07-03T19:27:13+03:00",
19-
"app/commerce-modules/customer/customer-accounts/page.mdx": "2025-02-26T11:17:42.327Z",
19+
"app/commerce-modules/customer/customer-accounts/page.mdx": "2025-07-25T12:03:05.017Z",
2020
"app/commerce-modules/customer/page.mdx": "2025-04-17T08:48:31.918Z",
2121
"app/commerce-modules/fulfillment/_events/_events-table/page.mdx": "2024-07-03T19:27:13+03:00",
2222
"app/commerce-modules/fulfillment/_events/page.mdx": "2024-07-03T19:27:13+03:00",

0 commit comments

Comments
 (0)