We have an app which merges customer accounts. Now after a source account is being merged into a primary account, the source account should be disabled.
This is to prevent account-sharing since we sell digital products.
We can't cancel the orders since they have already been fulfilled.
Scenario: Dude A purchases products, gives his account details to Dude B who could then merge the orders from Dude A. Therefore we would need some way of disabling A's account. This can be done in the Admin interface but I haven't found a way of doing it via the API.
Is this possible somehow?
If not, please regard this as a feature request. Thanks!
You can delete the source customer with the Customer API.
If you have control of the app that manages the customer accounts, you can create a webhook to delete the customer after it's been merged into a new account.
If that app is 3rd party, you might be able to ask them if they have an API or can send a webhook to a private app - then in your private app, you can set it to make the Shopify API call to your store to delete the customer.
thanks for the reply!
That worked for some time, but with the release of version 2019-10 I get the error
422 Unprocessable Entity - Error deleting customer
every time that function is called.
It may have been restricted recently since I can't recall the following comment was there before...and it worked up until one or two weeks ago
"A customer can't be deleted if they have existing orders" (although the source account does not have any orders after merging)
Aw man I hate when API update breaks functionality.
I guess you could continue using 2019-07 until this is resolved.
Or maybe instead of deleting, you can make a PUT request to change the email address, which would effectively disable anyone from using it. (assuming the customer knows to login to the new account so there's no friction)
funny thing is that it does not matter which API version I use, the error started appearing recently without me altering the version.
Anyway, a valid workaround for us is:
Try deleting the source order after it has been copied to the new account.
If that does not work (order placed on Shopify, not imported), cancel the fulfillment and then cancel the order. This will effectively remove the digital files for the customer account.
Thanks again for your help!