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

    Convert a Shopify Section to a Block (Horizon Theme version)

    Convert a Shopify Section to a Block (Horizon Theme version)

    In Horizon, Shopify allows developers to convert standalone sections into reusable blocks, giving merchants even more control in the theme editor. Let’s walk through the process step by step.

    September 30, 20267 min
    Fixing 404 Errors on Shopify Using URL Redirects

    Fixing 404 Errors on Shopify Using URL Redirects

    By using Shopify’s URL Redirects, you can quickly fix 404 errors, maintain SEO rankings, and improve customer experience.

    September 24, 202610 min
    10 Essential Shopify SEO Tips to Boost Your Store's Traffic

    10 Essential Shopify SEO Tips to Boost Your Store's Traffic

    Optimize your Shopify store for search engines with these 10 actionable SEO tips, covering setup, keywords, on-page optimization, and technical fixes. Improve your store's visibility, drive more traffic, and increase sales. Get started with Shopify SEO today!

    August 16, 20263 min
    Adding a Smooth Back-to-Top Button to Your Shopify Theme

    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