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
- Go to Shopify Admin → Online Store → Themes
- Find the your theme (e.g the Debut theme) and click Actions → Edit Code
- Step 2: Find the Price Code
You’ll want to edit the files where product prices are displayed:
- For product page:
sections/product-template.liquid
- For product listings (e.g., collection pages):
snippets/product-card-grid.liquid
orsnippets/product-price.liquid
In 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
- Open your store in incognito mode (logged out) — price should be hidden.
- Log in as a customer — the price should appear.
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 %}
About Jin Alkaid
Jin Alkaid: A Seasoned Shopify Developer
Jin Alkaid is a seasoned Shopify developer with over 10 years of experience in the field. Their expertise lies in creating exceptional online stores that seamlessly blend functionality, aesthetics, and user experience. Whether it’s setting up a new store, optimizing an existing one, or integrating custom features, Jin brings a wealth of knowledge to the table.