Stop certain tagged customers from ordering products

Stop certain tagged customers from ordering products

UltimateTCG
Visitor
3 0 0

Hi all, 

 

I'm looking for a way to stop particular customers from being able to order certain products. Specifically I'm trying to tag customers we do not want to be able to buy our "Pre-Order" items for various reasons. Is there a way of tagging the customer and products in a way where they either do not see them or cannot add them to cart?

 

Look forward to the feedback

Replies 4 (4)

JoesIdeas
Shopify Partner
2411 223 644

Yes, here's how I would approach this:

 

1) Find the add to cart button code in your theme

2) Add a conditional Liquid statement to hide the button for customers that have a certain tag, like this:

 

{% if customer.tags contains "some tag to hide" %}
<p>This is a custom message you can show to them.</p>
{% else %}
regular add to cart button code here
{% endif %}

 

3) Tag a customer, log in as that customer, and ensure it works according to plan.

 

I recommend duplicating your live theme first so you can edit code without affecting the live site.


The add to cart code you'll have to search a bit, I would start with the product Template and trace the included snippets to find the one with the button... a lot of times it's named something like product-form.liquid.

 

If you're not familiar with editing themes, I would read this first: https://speedboostr.com/how-to-safely-edit-your-shopify-theme.

 

Here's the reference for using Liquid with the customer object.

• Creator of Order Automator [auto tag, fulfill, connect FBA, order jobs]
• Co-Creator of Product Automator [suite of features for products / collections]
• Shopify developer for 10+ years, store owner for 7 years
• Blog: Shopify Tips, Guides, and Automation Tools
UltimateTCG
Visitor
3 0 0

Thanks I'll give that a try, will that effect all products or just specifically tagged products? Its just certain collections we don't want them able to order

 

UltimateTCG
Visitor
3 0 0

So I've managed to get to it work by adding the and product.tag contains to that tagged product and customer, it removes the add to cart button on the items i don't want ordered but keeps it where i do, thanks for your assistance! However how can I get the text on a single line??

UltimateTCG_0-1658925552140.png

 

JimJong
New Member
56 0 0

It is possible to stop certain customers from ordering specific products like pre-order products using the Cart Lock https://apps.shopify.com/cart-lock app easily. For this you have to do this:

 

  1. Open the app and click on the "Add a new rule" button.
  2. Click "Add a new condition" and select the "Products" then add your pre-order items.
  3. Click "Add a new condition" again and select the "Customer tags " then add the related customer tag.
  4. In the "Error message" field, add an appropriate message which will be displayed in the checkout page.
  5. Click "Match conditions" ALL
  6. Save the rule.

 

customer-tag.png

 

Now, the tagged customers cannot buy the pre-order items.