Hide Price When Customer Is Not Logged In

Easily hide product prices from guest visitors on your Shopify store. Require customers to log in to view prices and encourage account creation. Improve B2B privacy and control pricing visibility.

Hide Price When Customer Is Not Logged In
0 sections

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 or snippets/product-price.liquid
  • In these files, search for the code that looks like this:

    javascript
    {{ product.price | money }}

    Or:

    javascript
    {{ current_variant.price | money }}

    - Step 3: Wrap the Price in a Customer Check

    Replace the price code with the following:

    code
    {% 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:

    css
    .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.
  • Want to make the message clickable? Try this:

    code
    {% if customer %}
      {{ product.price | money }}
    {% else %}
      <a href="/account/login" class="login-to-see-price">Login to view price</a>
    {% endif %}
    Tags

    Related Articles

    Adding a Smooth Back-to-Top Button to Your Shopify Theme
    Tips & Tricks

    Adding a Smooth Back-to-Top Button to Your Shopify Theme

    Learn how to add a smooth back-to-top button to your Shopify theme using lightweight CSS and JS, improving navigation and enhancing user experience.

    August 13, 20263 min
    Shopify Requires Expiring Offline Access Tokens for Public Apps: What Developers Need to Know
    Tips & Tricks

    Shopify Requires Expiring Offline Access Tokens for Public Apps: What Developers Need to Know

    Shopify is making an important change to how public apps authenticate with the Admin API

    August 8, 202630 min
    Understanding Shopify Theme Check: LiquidHTML/Complexity
    Tips & Tricks

    Understanding Shopify Theme Check: LiquidHTML/Complexity

    Although this isn't a compilation or runtime error, it's an important indicator that your Liquid file has become too complex, making it harder to read, maintain, and extend over time

    July 30, 202620 min
    Migrating from PrestaShop to Shopify
    Tips & Tricks

    Migrating from PrestaShop to Shopify

    Migrating an e-commerce store from an open-source platform like PrestaShop to a hosted SaaS solution like Shopify is a common step for growing businesses looking to simplify store management and infrastructure overhead.

    July 24, 202615 min