Today, we will go over the process of re-assigning an email address if you have deleted a customer in nopCommerce. A lot of nopCommerce users might be aware of the fact that nopCommerce out of the box does not allow store owner to add a new customer with an email address that was deleted in past. Why? The reason is quite simple, the record is never deleted permanently in nopCommerce. When a store admin deletes a customer's account, the record is marked as "deleted" which means the email address stays in the database.
Here is an example of a customer record that was deleted:
As, you can see, the records stays in the database but the column "Deleted" is marked as "1". This simply means that this customer record won't show up in the customer list in the administration section but it still exists in the database.
What can we do to prevent this? Yes, if a store owner is a SQL database administrator, he/she can delete the customer record directly from the database. But, in reality how many store owners are SQL database admins or how many store owners wants to go through this time consuming process of deleting a customer records from database?
nopCommerce offers a great feature of adding a suffix "-DELETED" to all the customer's email address when their account is deleted from the administration section. This makes the option available to re-assign the same email address to a new account if you have deleted a customer in past with that email address. It also saves you from all the hassle of connecting to SQL database and manually deleting the customer's record.
There is a setting that will suffix a customer email with "-DELETED" every time when the record is deleted.
Go to: All Settings > search for "customersettings.suffixdeletedcustomers" (update this setting as True)
Let's delete a customer's account from the administration section:
Now, let's check the database:
Here, we can see that "-DELETED" suffix was added to the email address that will allow us to add a new custom record with the same email address.
Hope it helps!
A copy of this article is also available on Arvixe Blog