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

Solved

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

AlanaBT
Visitor
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!

Accepted Solution (1)

PaulNewton
Shopify Partner
6419 584 1360

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 %}​

 

 

 

https://shopify.dev/docs/themes/liquid/reference/objects/customer#customer-tags

https://shopify.dev/docs/themes/liquid/reference/filters/url-filters#customer_login_link

 

Shipping Rates and Shipping Profiles:

With single origin shipping and if there are no other products for that region then shopify.com/admin/settings/shipping > 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 > shopify.com/admin/settings/shipping >  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.

And

We don’t offer shipping to United Kingdom.

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

 

 

Save time & money ,Ask Questions The Smart Way


Confused? Busy? Get the solution you need paull.newton+shopifyforum@gmail.com


Problem Solved? ✔Accept and Like solutions to help future merchants

Answers powered by coffee Buy Paul a Coffee for more answers or donate to eff.org


View solution in original post

Replies 8 (8)

Dallas
Shopify Staff (Retired)
916 61 212

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.

To learn more visit the Shopify Help Center or the Community Blog.

PaulNewton
Shopify Partner
6419 584 1360

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 %}​

 

 

 

https://shopify.dev/docs/themes/liquid/reference/objects/customer#customer-tags

https://shopify.dev/docs/themes/liquid/reference/filters/url-filters#customer_login_link

 

Shipping Rates and Shipping Profiles:

With single origin shipping and if there are no other products for that region then shopify.com/admin/settings/shipping > 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 > shopify.com/admin/settings/shipping >  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.

And

We don’t offer shipping to United Kingdom.

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

 

 

Save time & money ,Ask Questions The Smart Way


Confused? Busy? Get the solution you need paull.newton+shopifyforum@gmail.com


Problem Solved? ✔Accept and Like solutions to help future merchants

Answers powered by coffee Buy Paul a Coffee for more answers or donate to eff.org


Web-Dev
Excursionist
22 1 2

@PaulNewton 

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 %}​
chcsep
Shopify Partner
79 3 33

@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 %}​

 

mxn
Tourist
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

 

Regards,

Mehdi

Dynamicpillar
Visitor
1 0 0

@PaulNewton wrote:

 

 

 

 

{% 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 %}​

 

 

 

 

https://shopify.dev/docs/themes/liquid/reference/objects/customer#customer-tags

https://shopify.dev/docs/themes/liquid/reference/filters/url-filters#customer_login_link

 

Shipping Rates and Shipping Profiles:

With single origin shipping and if there are no other products for that region then shopify.com/admin/settings/shipping > 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 > shopify.com/admin/settings/shipping >  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.

And

We don’t offer shipping to United Kingdom.

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

 

 

 



@PaulNewton wrote:

 

 

 

 

{% 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 %}​

 

 

 

 

https://shopify.dev/docs/themes/liquid/reference/objects/customer#customer-tags

https://shopify.dev/docs/themes/liquid/reference/filters/url-filters#customer_login_link

 

Shipping Rates and Shipping Profiles:

With single origin shipping and if there are no other products for that region then shopify.com/admin/settings/shipping > 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 > shopify.com/admin/settings/shipping >  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.

And

We don’t offer shipping to United Kingdom.

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

 

 

 




Is there a way to prevent a customer from purchasing a specific product. Ultimately we're trying to prevent a returning  customer from purchasing a specific product they already purchased and limit the product to one per customer(not one per checkout)

manish22
Shopify Partner
32 0 1

Hi @AlanaBT 

 

I am Manish from the miniOrange team. You can use our LockOn Restrict Store Content.

With the help of this application, you can easily restrict the add-to-cart functionality using Customer Tags lock mechanism. 

 

Once the user logs in, our application will search for the specified tag in their user profile. If the mentioned tag is present, the customer is granted access to add products to their cart; otherwise, the button will be locked. 

 

Since you have also mentioned that you cannot sell products in Australia, you can go ahead and check out the Location lock mechanism as well. Anyone accessing the store from Australia will be locked out and unable to add products to their cart.

 

I hope this helps you. Thanks.

Jahid-KlinKode
Excursionist
145 1 5

Hey @AlanaBT, need a step-by-step guide for a Members-Only Store on Shopify? Watch this helpful video: