How to block customer login from specific email domain?

We are using the new customer account system which allows customer login through Shopify oauth / Google oauth / Facebook oauth, etc.

But some of these email addresses are generated randomly, these email are fresh to our store and applicable to the discount we prepared for our fresh customer, this is not what we want, and it results in unexpected loss.

How to forbid customer login from specific email domain?

e.g.

Assuming there is a hook can be called after login processed, and I can provide a regex rule for that hook to verify whether the customer can access our store(or login failed / forbidden).

Hi @Polarove

There is no parameter, rule, or callback you can configure on Shopify’s login side to say “block @example.com” or run custom email-domain logic before login succeeds.

Have you explored setting limits on the discount instead - that might be an easier solution to this. EG: you could create a customer segment that excludes certain email domains (e.g. all customers where email ends_with “@tempmail.com” or similar, depending on the segment query syntax), and the define your “fresh customer discount” so it only applies to the segment of “new customers minus bad domains.”

1 Like