As someone in the replies stated already, there should be a way to stop this from the customer log in section. If you are unable to, then you could reach out to the Shopify support team incase it is a related issue.
Yes, it can be done with a custom code. We suggest you hire a Shopify expert who can help you add this feature to your store without affecting any other functionality.
Let us know if you need any further help with this issue.
All the best,
CedCommerce || Shopify Expert - Let us know if our reply is helpful for you. Like it. - Was your question answered? Mark it as an accepted solution. - For further discussion contact: Email ID- email@example.com - Whatsapp:- Join Here