How can I make only certain tagged customers able to order a product

New Member
3 0 0

Currently building my page and am planning on offering discounts via BOLD for certain groups of customers. However, I want to know if I can turn off the "add to cart" of certain products for some groups but allow "add to cart" to others based on these tags (we have a product we cannot sell within Australia, but we can sell to international customers).

We used to stop the order going through at the cart, however, this had a detrimental effect on our conversion rate and we found we were losing A LOT of customers, so I was hoping I could only make this available to certain people once they sign in.

If there is an app or I need to get code, please let me know your thoughts as I need all the help I can get!

Shopify Staff
Shopify Staff
907 60 180

Hey, there.

Dallas here from the Shopify Social Care Team.

Great question and I am happy to say that I think I have some options that would work well for you. Rather than organizing your customers by tags I think it would be better to organize your customers by postal code orzipcode. In order to achieve this you're going to need to get an app. Each one has different features, but a quick summary of each app that I think could work for you:

1. Easy Country Blocker

This app would be if you wanted to block customers from your site entirely.

2. Geo Targeting ‑ Custom Pop‑Ups

This app would allow you to create different pop-ups & banners that only visitors located in certain areas could see. It would detect your visitors' locations which you can filter by country or zipcode and then depending on their location they would see/would not see the popup.

ie. If you are restricting visitors from Canada, all Canadian visitors will see a pop warning with a message that your store does not offer shipping to Canada. Unlike Easy Country Blocker, this app will not restrict these visitors to access to your site and continue browsing. If you choose to install this app, I do recommend to also install Easy Shipping Restrictions, in case your visitors missed the pop-up.

3. Product Zipcode Validator

This will prevent customers from accessing specific products until their zipcode is compared against a list of areas that you have approved. It will add a field on the product page that will be used to verify the zipcode/postal code

4. Locksmith 

My fourth and final suggestion is the Locksmith app. This would basically lock the page via password. If they enter one of the passwords you create then they will be able to access the page and add that product to cart. If you wanted you could make the passwords a list of all the countries that the product is available in. Then you could ask them "what country are you located?". If they type the country that matches your list of approved countries then they will be able to enter the store. I hope that makes sense.


Based on my understanding of what you're looking for I think these would be the best options in order to achieve this. Please feel free to ask me any further questions after you have a chance to go through the options.

Dallas | Social Care @ 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 the Shopify Help Center or the Shopify Blog

Shopify Partner
2584 136 472

This is an accepted solution.




{% if customer %}
 {% if customer.tags contains TAGNAME %}
  <button disabled class="add_to_cart">Inelgible</button>
 {% else %}
  <button class="add_to_cart"/>Add To Cart</button>
 {% endif %}
{% else %}
 <button class="">{{ 'Log in' | customer_login_link }}</button>
{% endif %}​


Shipping Rates and Shipping Profiles:

With single origin shipping and if there are no other products for that region then > Manage Rates > Create Shipping Zone > make a shipping zone for that area but without any rates then the admin message will be:

"No rates. Customers in this zone won't be able to complete checkout."


With multiple origin shipping for a specific product > >  CUSTOM SHIPPING RATES > Create New Profile > Manage Products

Customers will see a message like this in checkout

Your cart has been updated and the items you added can’t be shipped to your address. Remove the items to complete your order.


We don’t offer shipping to United Kingdom.

Shopify - Shipping Profile - Product- Exclude Austrial Error - Shipping - Checkout.png



Problem Solved? ✔️Accept and ? Like the solution so you can help others.
Buy me a coffee ☕ or donate to
Confused? Busy? Buy a custom solution
22 1 2


Can you please explain what you have done with this code? It looks like it may work for me, just not sure how to implement.

If I want to restrict customers from specific state to purchase specific item, I can create a custom shipping zone to prevent them from checking out. But, for the product page, it would be nice to have the add to cart button disabled for those customers. 

Would this code work for customer.addresses? Or are customer locations saved in tags? And, how would it work for new customers that don't yet have an address associated with their account?

{% if customer %}
{% if customer.addresses contains 'STATE' %}
<button disabled class="add_to_cart">Inelgible</button>
{% else %}
<button class="add_to_cart"/>Add To Cart</button>
{% endif %}
{% else %}
<button class="">{{ 'Log in' | customer_login_link }}</button>
{% endif %}​
11 1 4

Do you know a solution for following request:


make a specific discount code only valid for customers with existing orders?


For example: I am shipping a discount code along with every order, so a repeated order is attracted. but I don't want customers, who never ordered anything to benefit from this code




30 1 11

@mxn I hope you've asked this in a separate thread, but the answer to your question is: go to your Customers section, perform a search ("more filters") for Number of Orders > More than this number, enter 0. Then save that filter as "customers with orders". That will create a customer group. Then when you create your discount code, under "Customer Eligibility", select "Specific groups of customers" and then search for the group "customers with orders".


@Web-Dev You had 'STATE' in quotes, which means that your code would only trigger if the customer had an address that had the word 'STATE' in it.You need to define "state" as a variable or array, and then compare it to the customer's address(es). 

This code (should) produce an array for the states you want to match, and then look through the customer's addresses to see if they have one that is in one of the listed states:

{% assign eligible_state = 'Alabama,Florida' | split: ',' %}
{% if customer %}
  {% for customer_address in customer.addresses %}
  {% if eligible_state contains customer_address.province %}
    {% assign customer_is_eligible = 1 %}
  {% endif %}
  {% endfor %}
  {% if customer_is_eligible -%}
    <button class="add_to_cart"/>Add To Cart</button>
  {%- else -%}
    <button disabled class="add_to_cart">Inelgible</button>
  {%- endif %}
{% else -%}
  <button class="">{{ 'Log in' | customer_login_link }}</button>
{%- endif %}​