Have your say in Community Polls: What was/is your greatest motivation to start your own business?
Our Partner & Developer boards on the community are moving to a brand new home: the .dev community forums! While you can still access past discussions here, for all your future app and storefront building questions, head over to the new forums.

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

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
Community Manager
3108 344 889

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