To hide the price in Shopify when the customer is not logged in, you can use Liquid to check if a customer is logged in. Here's how:
- Step 1: Open the Theme Editor
- Step 2: Find the Price Code
You’ll want to edit the files where product prices are displayed:
sections/product-template.liquidsnippets/product-card-grid.liquid or snippets/product-price.liquidIn these files, search for the code that looks like this:
{{ product.price | money }}Or:
{{ current_variant.price | money }}- Step 3: Wrap the Price in a Customer Check
Replace the price code with the following:
{% if customer %}
{{ product.price | money }}
{% else %}
<span class="login-to-see-price">Login to view price</span>
{% endif %}- Step 4: (Optional) Style the Message with CSS
To make the message more visible or styled nicely, go to:
Assets → theme.scss.liquid and add:
.login-to-see-price {
color: #cc0000;
font-weight: bold;
display: inline-block;
margin-top: 5px;
}- Step 5: Test the Result
Bonus: Link to Login Page
Want to make the message clickable? Try this:
{% if customer %}
{{ product.price | money }}
{% else %}
<a href="/account/login" class="login-to-see-price">Login to view price</a>
{% endif %}




