Hide One Product Variant from Tagged Customers & Products

RachelQuagliani
New Member
1 0 0

Hi folks, I have recently started working on a client's Shopify store to implement some changes. I am new to Liquid, coming from Squarespace I have knowledge of html/CSS and have managed to achieve all but one thing so far with Liquid. I've trawled the forums which have instructions on how to hide product variants when they are out of stock, but I only want to hide ONE variant (the 'Large' option) from customers tagged with 'wholesale' and only from this ONE product (which I have also tagged with 'wholesale'), and I can't seem to adapt anything to work! The closest I got was hiding ALL the variants (really not helpful at all )... I have tagged the customer account & product with 'wholesale' but not sure how to weave this in properly... Any advice would be greatly appreciated!

Please let me know if I need to share code here and if so from which file?

Screenshot with notes on what I'm trying to achieve... Red option needs the change, everything else in green to stay the same...

RachelQuagliani_0-1613993232445.png

Store preview link: https://ivh26f10oodapik2-21707687.shopifypreview.com

Product link: https://ivh26f10oodapik2-21707687.shopifypreview.com/collections/all/products/mini-plaiting-thread

Thanks so much in advance anyone who may be able to help!

 

0 Likes
Stuart_Brown
New Member
3 0 0

I'm also looking for this!

You can use an if statement in order to set things up to show if the customer is tagged 'wholesale':

 

{% if customer.tags contains 'Wholesale' %}
{% endif %}

 

But I've had no luck in trying to get specified variants to show. In my case I've been trying to show or hide any variant with a particular value in one of the options. Each product has two variants both with an option called "Pricing Type" and two possible values, "Retail" or "Trade". I feel this should be very easy, but working with the variants object is proving tricky as they return values in arrays in the product and collection templates.

There's a post on this forum which suggests there is a way of doing this: https://community.shopify.com/c/Shopify-Design/show-hide-a-product-variant-based-on-a-customer-tag/m...

0 Likes