Blocking non approved accounts

Solved
New Member
4 0 0

I am attempting to lock off my store without using a third party app.  Is there any way possible to associate a tag with accounts that my staff approves that will allow access to the entire store?  Right now you are able to create an account and immediately have access to the store, we are attempting to create a wholesale site and don't need retail customers ordering from this page.  Is it possible to input a line of code on our product liquid page to disallow an account without proper tags to access the page?  What code would I use?

0 Likes
Shopify Partner
94 5 8

It is possible, however, it requires a combination of liquid & javascript both.

0 Likes
New Member
4 0 0

Could you point me in the right direction of where I should look?

0 Likes

Success.

Astronaut
1082 147 272

You can tag your customers something like "approved" and then go into your theme.liquid and find {{ content_for_layout }} and wrap it inside an if statement like:

 

{% if template.name == "login" or template.name == "register" or customer.tags contains "approved" %}
  {{ content_for_layout }}
{% else %}
Sorry your account needs to be approved to view our store {% endif %}

Where template.name == "login" or register is whatever page they need to register.

 

Edit: Whoops, saw you only want this for your product page. You can wrap your entire product.liquid in that if statement if that's the case.

If you'd like to make any edits to your store, please send me a personal message and we can discuss what you'd like to accomplish :D
0 Likes