I’ve created a product template specifically for wholesale products (templates/product.wholesale). I’d like to hide the price, quantity selector, and checkout button from all customers unless they are logged in and tagged as “wholesale.”
Does anyone know the best way to implement this within the Dawn theme? Ideally, I’d like to modify the Liquid template to conditionally display these elements only when a customer is logged in and has the “wholesale” tag.
Any help or code snippets would be greatly appreciated!
You can definitely achieve this by modifying your product template in the Dawn theme. You’ll want to wrap the price, quantity selector, and checkout button in a conditional check that ensures the customer is logged in and has the “wholesale” tag.
Here’s how you can do it:
Edit your templates/product.liquid file and wrap the relevant elements with this Liquid code:
{% if customer and customer.tags contains 'wholesale' %}
{{ product.price | money }}
{% else %}
Please log in as a wholesale customer to view pricing.
{% endif %}
This ensures that only logged-in customers with the “wholesale” tag can see the pricing and purchase options. Anyone else will just see a message prompting them to log in.
(Disclaimer: I’m the developer of Latch.)
If you want a no-code solution, Latch lets you lock products and checkout for specific customer tags automatically, without modifying Liquid code. It can also redirect/upsell non-wholesale users, if desired.