Always let the user verify/activate his account via email when creating customer accounts

af4
Shopify Partner
1 0 0

We have a custom storefront with the API and hydrogen. We need to create an account where if it is an existing account or a non existing account always will send the /email_templates/customer_account_activate/ email where the customer needs to verify his/her email adres. In our case we call the api with a non existing customer the customer get send email_templates/customer_account_welcome/ email and the customer does not need to verify his/her email adress. This way a robot can create fake accounts in our Shopify database. Is it possible to always send the account activate email when an account will be created and the user can not log in without activating his account first?

So the needed steps will be:

1. Customer provides his/her name (first + last name) and email

2. Customer will receive activation email and gets linked to the account activation page where he/she will set the password twice

3. After succesfully activating the account he/she gets logged in and can use the account with a verified email

Reply 1 (1)

Liam
Shopify Staff
2731 302 777

Hi Af4,

 

Shopify’s native behavior sends a welcome email for a new customer and an activation email for customers when accounts are required. Since you want to send the activation email in both cases, you might need to intercept or modify the email behavior.

 

One way could be to use the webhook for customer creation, and then trigger the activation email manually using an email service or another approach. You'd need to keep the activation link consistent with Shopify's link structure for activating accounts.

 

Then when the customer clicks the activation link in the email, you'd lead them to a page where they can set their password. Once they've set it, their account state can be changed to "active" or "enabled".

 

Hope this helps!

Liam | Developer Advocate @ Shopify 
 - Was my reply helpful? Click Like to let me know! 
 - Was your question answered? Mark it as an Accepted Solution
 - To learn more visit Shopify.dev or the Shopify Web Design and Development Blog