How to block a customer on Shopify

Follow our guide to block or restrict access to registered customers based on a customer tag and a very easy to implement code method
Froonze
January 11, 2024

E-commerce can be a rewarding endeavor but also demands dealing with a variety of challenges. Blocking customers on Shopify can be a necessary step to protect your business from fraud, harassment, ordering mistakes or violation of your store’s policies. Apart from fighting fraud, blocking customers can also help managing your inventory levels or the limits of product quantities that a customer can purchase. Banning customers may be even more relevant when options for manual payment like Cash on Delivery (COD) are available. In any case it should be a last resort, but it can be an effective way to maintain a positive shopping experience for other customers and your store's reputation.

This guide will walk you through the process of how to block customers on Shopify from accessing your site, and optionally, preventing them from completing purchases. The method will require you to be familiar with Classic customer accounts and having them enabled in Shopify, as the access restriction is based on customer tags. Blocked customers will be automatically and immediately logged out after log-in, with an alert message that you can customize. To restrict purchases you must also enable the Shopify option "Require login before checkout".

How to block a registered customer from accessing and purchasing in Shopify

  • Go to your Shopify admin and navigate to Online Store > Themes. Find the theme you want to edit and click on the Three points icon > Edit code.
  • Search for the main layout theme.liquid and open it.
  • Locate the closing </body> tag in the right-hand side panel and insert the next script immediately above it. This script will prevent any customer with the 'blocked' tag from logging in. The alert message can be customized as needed.

{%- if customer and customer.tags contains 'blocked' -%} <script> sessionStorage.setItem("blocked", "true"); window.location.href = "/account/logout?return_url=%2Faccount"; </script> {% endif %} {%- if template contains 'login' -%} <script> const blocked = sessionStorage.getItem("blocked"); if (blocked) { alert( "You're not allowed to log in. Please contact us for more information" ); sessionStorage.clear(); } </script> {% endif %}

Shopify Theme Editor - Block tagged customer fix
  • Now go to Shopify > Customers, click on the customer you want to ban, and add the tag 'blocked'. This step is pretty straightforward but if you need more details about adding tags you can find them in this documentation. If you plan to block many customers at once, you can select different customers and then click on Bulk Edit below to ease this operation. You can also could import the list of customers you want to block and tag them at the same time. This is a built-in Shopify feature that you can use while importing. Or in a similar way, use a CSV file to update a list of existing customers with the tag 'blocked'.
  • What we have described above will prevent these customers to log in the shop. If you also want to restrict their purchases, make sure the Checkout option "Require customers to log-in before checkout" is enabled in Shopify. You can find more details about quickly enabling this option in this section
  • You are done now. Keep in mind that customers identify their accounts in Shopify using their email addresses, so they could potentially bypass the block by logging in with a different email address. For a more robust implementation, consider requiring specific information during registration or even manually verifying every new account with the help of an app.

Custom Forms: collect additional customer data and have more control over account registration

Blocking Accounts and having more strict policies to create accounts are two features that go hand-in-hand. They are often used together to make sure that only authorized customers can create accounts or make purchases. Shopify does not offer these features natively, but our Custom Forms plugin does.

  • In the Basic Plan you can use Email Verification. Submission of registration form creates an inactive customer account that needs to be verified by email
  • In the Advanced Plan you can use Account Approval. Each submission will result in an application that you as an admin will need to approve or reject before the account can be created

Besides you can replace the registration form to require additional information during registration. Get to know more about this valuable plugin. Build custom registration and profile forms to collect any information you need from your customers: ☑️ Custom Forms

Related Questions

Can you block a customer on Shopify?

If not blocking or blacklisting as such, you can restrict him to log-in with the same email address, and thus, restrict him as well to complete purchases, with the method described above.

Can the block be circumvented?

Customers identify their accounts in Shopify using their email addresses, so they could potentially bypass the block by logging in with a different email address. For a more robust implementation, consider requiring specific information during registration or even manually verifying every new account with the help of an app. Our Custom Forms plugin can help you collect additional customer data and have more control over account registration.

What are the benefits of banning customers in Shopify?

Banning customers on Shopify can be a necessary step to protect your business from fraud, harassment, ordering mistakes or violation of your store’s policies. Apart from fighting fraud, blocking customers can also help managing your inventory levels or the amount of products customers can buy per month. For example, you could try creating a workflow to automatically tag the customers that exceed in their orders.

Can you import a list of blocked customers with this method?

Yes, Shopify has a built-in feature to tag the customers that you import with the CSV file. So you'd just need to import them with the tag 'blocked' and implement the script above as well, in theme.liquid. You can check the Import documentation in Shopify for some more details, or just go ahead with it, go to Shopify > Customers, click on Import, then enter the tag.

Can this method be used with Shopify New Accounts dashboard?

No because the New dashboard won't allow running scripts, hence the customer will be able to log in with his/her/their email address, regardless of the tag.

What's the difference between blocking a customer with your method and disabling their accounts?

Disabled accounts can be reactivated with a customer action. If the customer tries to register again using the same email address, an invitation will be sent.

Are there other solutions to achieve this?

There are some apps in Shopify that can help you create rules to flag or prevent known customers from placing orders on your store. Shopify has its own Fraud Filter app. The code solution described above is totally free.

Froonze Customer Accounts Concierge
Get the app today
Turn the account page into a beautiful portal with
Froonze Customer Accounts Concierge
  • 220+