Hiding Products By Vendor Unless Logged In

Hiding Products By Vendor Unless Logged In

flowerpawedible
Shopify Partner
2 0 0

I'm trying to hide certain products on my site which has retail and wholesale products. My wholesale products are sorted by vendor with the tag "wholesale". I only want retail products showing unless the customer is logged in. 

 

I'm familiar enough with the code to add this,

 

 

 

{% if customer %}
  <!-- Display the product content -->
{% else %}
  <!-- Display a message or redirect to a login page -->
{% endif %}

 

 

 

but I am not sure how to go about just hiding just the products that are tagged "wholesale". 

Would anyone be able to guide me with this? 

Thank you! 


Reply 1 (1)

flowerpawedible
Shopify Partner
2 0 0

Okay, I think I have the code I need, but I am not sure where to put it. It would usually go inside the product.liquid section, but I can't find that one, I see main_product.liquid...would this be where I place the following code? 

 

{% if customer %}
  {% for tag in product.tags %}
    {% if tag == 'wholesale' %}
      <!-- Display product details for wholesale customers -->
      <!-- You can place your product content here -->
    {% endif %}
  {% endfor %}
{% endif %}

 

Thank you!