What are the best methods of creating accounts for emails that ordered as a guest

I went and tested a few of these to make sure I was getting the result. These were tested on API v2022-04:

For #1 we both had the same result.

#2 returned the customer as null and and a message in customerUserErrors that said: “We have sent an email to test@email.com, please click the link included to verify your email address.” Which to me is the ideal behaviour.

Moreover, the activation form, I’m using the shopify theme ( not headless ) requires a password to activate. So why does customerCreate require a password? I would understand if the user had to repeat and confirm their password, but customCreate password can be different from the Activation password.

The weirdness here is likely partially a result of using both a theme and the Storefront API at the same time. customerCreate is usually the first step in a headless flow and that doesn’t require any email confirmation, unless the account already exists.

For #3 I get the customer as null and an error message saying the email is already in use. You wouldn’t want the customer object here because then anyone can fetch a customers details (addresses and order history) by trying to create an account with their email which would be a huge security issue.

I guess this is to say on my test everything seems to be working as I’d hope/expect. Maybe using customerGenerateAccountActivationUrl from the Admin API might be a better option for you if the Storefront API isn’t getting the responses you’d expect? What API version are you using?