How to hide prices unless customer is logged in?

jcastro
Tourist
6 0 25

I am trying to create a wholesale site where customer can navigate my site, see products, but not be able to see pricing or add to cart button unless logged in.

Replies 23 (23)

-Emma-
Shopify Staff
89 10 30

Hi, there!

 

Emma here from Shopify. Happy to help you out with this today.

 

It sounds like what you're wanting to accomplish with your store can be set up with the use of an app such as Locksmith.

 

The Locksmith app developers have created a "simple yet powerful tool to help you make sure the right people see the right things in your Shopify store"

 

Among other features included with this app, you can use "Locks" to restrict access to:

 

  • Your entire shop
  • Pages
  • Products
  • Collections
  • Prices
  • The shopping cart
  • The login page
  • The registration page, and
  • Product variants

 

The app includes a 15-day free trial, so I'd recommend giving that a try to see if it will work well for your business. So long as the app is removed within the trial period, there would be no charges on your account. 

 

Let us know how you make out!

 

Emma | Shopify Support

 

-Emma- | Social Care @ Shopify 
 - Was my reply helpful? Click Like to let me know! 
 - Was your question answered? Mark it as an Accepted Solution
 - To learn more visit the Shopify Help Center or the Shopify Blog

jcastro
Tourist
6 0 25
Is there a solution where I don't have to pay?  I'm looking to switch to Shopify from another platform, but my other platform does not charge me for this feature.  I can simply turn on member prices or shut it off.
-Emma-
Shopify Staff
89 10 30

We do have an enterprise level plan - Shopify Plus - which includes a wholesale channel. Let me know if you'd be interested in hearing more about this option, and I'd be happy to set up a conversation for you! 

Otherwise, the only option would be using an app like the one I mentioned earlier. If you'd like, I can pass your feedback along to our development team about having wholesale options included with all plan levels. We are always looking for ways to improve Shopify, and truly value your feedback! 

Emma | Shopify Support

-Emma- | Social Care @ Shopify 
 - Was my reply helpful? Click Like to let me know! 
 - Was your question answered? Mark it as an Accepted Solution
 - To learn more visit the Shopify Help Center or the Shopify Blog

jcastro
Tourist
6 0 25

I found a solution.

 

Went to theme > Edit Code > Sections > product-template.liquid 

Once on the template hit CTRL F to access the find option and look for: product_price

Added the following code in Red Bold to hide price

 

{% if customer %}
<div class="product__price">
{% include 'product-price', variant: current_variant %}
</div>
{% else %}
<b>Our Price:</b> (Dealers Only)
{% endif %}

 

You can change <b>Our Price:<b> (Dealers Only) to what ever you'd like to substitute the price with.

 

To hide the add to cart button I did the following:

On the same template hit CTRL F to access the find option and look for: addtocart

Added the following code in Red Bold to hide price

 

{% if customer %}
<div class="product-form__item product-form__item--submit{% if section.settings.enable_payment_button %} product-form__item--payment-button{% endif %}{% if product.has_only_default_variant %} product-form__item--no-variants{% endif %}">
<button type="submit" name="add" id="AddToCart-{{ section.id }}" {% unless current_variant.available %}disabled="disabled"{% endunless %} class="btn product-form__cart-submit{% if section.settings.enable_payment_button %} btn--secondary-accent{% endif %}">
<span id="AddToCartText-{{ section.id }}">
{% unless current_variant.available %}
{{ 'products.product.sold_out' | t }}
{% else %}
{{ 'products.product.add_to_cart' | t }}
{% endunless %}
</span>
</button>
{% if section.settings.enable_payment_button %}
{{ form | payment_button }}
{% endif %}
{% endif %}
</div>
{% endform %}

 

 

-Emma-
Shopify Staff
89 10 30

Excellent! I'm glad you've found something that works for you. 

Wishing you much success with your business, 

Emma | Shopify Support 

-Emma- | Social Care @ Shopify 
 - Was my reply helpful? Click Like to let me know! 
 - Was your question answered? Mark it as an Accepted Solution
 - To learn more visit the Shopify Help Center or the Shopify Blog

Daisydigital
Shopify Partner
1 0 1

Hi, 

 

Thanks for sharing your solution. What did you do for the membership side of things? For people to apply to be members?

 

Thanks again

sondosfashion
Tourist
13 0 1

Thank you alot for sharing your solution. 
Most of the official replays are : Buy this ... and pay for upgrade ....  . 


But I have a question : 
I opened the  product-template.liquid , But I can not find "product_price" . Maybe It is hiden in new versions or I did some thing wrong. 
Can you Help me. 

Thank you

richman_aust
Visitor
1 0 0

This descriptor has 2 underscores. i.e. product__price instead of product_price

Healthyhairpro
New Member
4 0 0

Hi!! I tried using your code but it doesn't hide, it just shows price with a "Our price Professional Only' message. DO you have a code to actually hide unless customer is logged in?

mahmudnsu
Visitor
2 0 0

Great work buddy! Can you try to solve one more problem like this? I heard it is possible to hide the "Cost per item" price section from the staff. Since I hav no technical knowledge for this, so its nearly impossible for me. Can you give a try please? TIA

sannezijlstra
Shopify Partner
1 0 0

Hello, When i Add the line there is a error when i safe.

{% if customer %}
{% when 'product_price' %}
<div class="product__price">
{% include 'product-price', variant: current_variant, product: product %}
</div>
{% else %}
<b>Our Price:</b> (Dealers Only)
{% endif %}

 

Error message:

  • Liquid syntax error (line 241): Unknown tag 'when'

can you help?

Naresh_NFD
New Member
8 0 0

You can mail me i'll  see what actually is you want.

 

R-Daneel
Excursionist
12 0 14

Hi! Move your if statement inside of your when statement:

{% when ... %}
    {% if customer %}
...

    {% endif %}

 

kiandratrickett
Shopify Partner
1 0 1

i cant find the product-template.liquid in my theme. What one would this work for?

JaviExpress
Shopify Partner
154 15 23

@kiandratrickett 

 

We think it's better applied directly in the price snippet so we wrote an article to read here

Customer Accounts Concierge
Turn the account page into a beautiful and multifunctional customer portal. Integrate contents, tools, and CRM features from other apps to drive a longer, richer and more personalized customer experience: Profile, Order History, Loyalty, Wishlist, Social Login, Customer Forms.
Shayankhan889
Visitor
1 0 0

i cant find product_price in product-template.liquid

axiom
Visitor
1 0 0

Id like to see your wholesale store options.

rpatter6
Visitor
1 0 0

Emma, 

 We have a shopify plus account and also a wholesale theme, how do we set it up so the customers cant see prices until they log in?

Naresh_NFD
New Member
8 0 0

You can mail me i'll  see what actually is you want.

 

ovidiucaramida
Shopify Partner
19 0 10

This app does just what you need https://apps.shopify.com/login-to-see-price-b2b

If hides the prices for not logged customers and replaces them with a customizable message box.

FARMERDAVE
Visitor
1 0 0

Hi Jcastro! Can you tell me what the other site is? I am looking for something like it. 

R-Daneel
Excursionist
12 0 14

If you want to limit information on the page to only customers who have been assigned to a company location, you can use:

{%- if customer.b2b? -%}
{%- endif -%}
R-Daneel
Excursionist
12 0 14

I should have added that this is for a wholesale store.