Erasure and reassignment
Erasing a customer's personal data, and moving their orders to another account first.
The two destructive customer operations, and the read that says whether either will be refused. See Customers, wishlists, reviews and retention.
What is stopping a customer being erased
/api/v1/kahunacart/customers/{id}/erasure-blockers
Say whether this customer can be erased and, when they cannot, name every reason — an order still awaiting payment or awaiting despatch, a download they can still fetch, and whatever add-ons report holding on their behalf such as an active subscription or an issued licence. Writes nothing. Call this before erase_customer.
Parameters
| Name | Type | Description |
|---|---|---|
| id required | integer | The customer. |
Erase a customer
/api/v1/kahunacart/customers/{id}/erase
Anonymise a customer and everything that points at them: the email, the names and addresses frozen onto their orders, their saved address book, their login, their wishlists, and the identity behind their reviews. No order is deleted and no amount changes, so sales statistics are exactly the same afterwards. Refused with the blockers named when anything still holds data on their behalf. There is no undo.
Parameters
| Name | Type | Description |
|---|---|---|
| id required | integer | The customer to erase. |
Move a customer's orders to another customer
/api/v1/kahunacart/customers/{id}/reassign-orders
Move every order from one customer to another, with its history, its notes, its refunds and its download grants. Each order gains a history entry naming the move. Send dry_run to find out exactly what would move without moving anything.
Parameters
| Name | Type | Description |
|---|---|---|
| id required | integer | The customer to move orders from. |
| to_customer_id required | integer | The customer to move them to. |
| dry_run optional | boolean | Report what would move and write nothing. |
Merge one customer into another
/api/v1/kahunacart/customers/{id}/merge
Merge a customer into another one, for somebody who bought under two addresses. Their orders, saved addresses, wishlists, customer groups, store credit, payment platform ids, saved payment methods, reviews, back-in-stock alerts and custom field values move to the customer you keep, and plugins that keep records by customer id (licences, a forum, a newsletter) move theirs too. The merged address is kept and from then on opens the other customer's account: checkout puts its orders there, and signing in with it uses the other account's password. The merged customer's own sign-in is switched off. Nothing is deleted. Send dry_run first: it writes nothing and answers the full report and any blockers a plugin raised, which are warnings for you to weigh. A real merge reads the blockers again just before it writes and returns them as warnings. The same merge run again moves whatever is left and is safe; the response lists what every part answered, and a part that says failed: is finished by running it again.
Parameters
| Name | Type | Description |
|---|---|---|
| id required | integer | The customer to merge away. |
| to_customer_id required | integer | The customer to keep. |
| dry_run optional | boolean | Report what would move and any blockers, and write nothing. |
Call erasure-blockers first. It names what stands in the way of erasing this customer, such as an order still inside the retention window, so the refusal is something you can show a person rather than a 409 you have to explain.
Caution
Erasure is irreversible. Reassigning the orders moves the commercial record to another account before the personal data goes.