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

    Boosting Customer Retention with Email and SMS Marketing on Shopify
    Tips & Tricks

    Boosting Customer Retention with Email and SMS Marketing on Shopify

    Learn how to leverage email and SMS marketing to drive repeat sales, increase brand exposure, and improve customer retention for your Shopify store. Discover practical strategies and actionable tips to enhance your marketing efforts. From personalized messages to timely re-engagement campaigns, we've got you covered.

    June 28, 20262 min
    Connect GitHub to Shopify
    Tips & Tricks

    Connect GitHub to Shopify

    Connecting GitHub to Shopify allows you to version control your theme code, collaborate with your team, and deploy changes smoothly

    June 22, 202610 min
    10 Actionable Shopify SEO Tips to Boost Your Store's Ranking
    Tips & Tricks

    10 Actionable Shopify SEO Tips to Boost Your Store's Ranking

    Improve your Shopify store's visibility and drive more sales with these 10 actionable SEO tips. From keyword optimization to site speed and mobile-first design, learn how to boost your store's ranking and attract more customers. Start optimizing your store today and watch your sales soar.

    June 20, 20264 min
    How to Add a Smooth Back-to-Top Button to Your Shopify Theme
    Tips & Tricks

    How to Add a Smooth Back-to-Top Button to Your Shopify Theme

    Learn how to add a back-to-top button to your Shopify theme with lightweight CSS and JS, improving user experience and navigation. Follow our step-by-step tutorial for a seamless implementation.

    June 18, 20263 min