Looking for way to have pricing hidden unless logged in

Solved
New Member
1 0 0

Hi,

I am trying to find out how to have my website pricing hidden and no ability to order, until the visitor is logged in. I also need visitors to register for an approved account to be authorised. I am wholesale-only, b2b, so don't not need retail prices visible. Can anyone advise apps?

Thanks.

0 Likes
Highlighted

Success.

Tourist
4 1 3

 The documentation for unless says: 

Like if, but executes a block of code only if a certain condition is not met (that is, if the result is false).

https://help.shopify.com/themes/liquid/tags/control-flow-tags#unless

So, wrapping the price with {% unless customer %} would hide the price from all logged in customers, but show it to anyone not logged in. I tested your method and was stumped why it wasn't working, until I realized this. The user is looking or the opposite behavior.

I believe you would want to wrap the price and/or add to cart buttons with the following in order to hide the price from non-logged in customers:

{% if customer.has_account == true %}

Your older post about this (https://ecommerce.shopify.com/c/shopify-discussion/t/can-you-hide-prices-and-add-to-cart-buttons-bef...) also has the answer backwards, in the same fashion.

0 Likes
Highlighted

Success.

Tourist
6 1 1

Hi,

Simply put the section that shows the price (div, paragraph, form) between : {% if customer %} --- {% endif %}.

For instance: 


    {% if customer %}
    <div class="h2 product-single__price">
      {% if product.compare_at_price_max > product.price %}
        <span class="visuallyhidden compare-price-a11y">{{ 'products.general.sale_price' | t }}</span>
      {% else %}
        <span class="visuallyhidden price-a11y">{{ 'products.general.regular_price' | t }}</span>
      {% endif %}
      <span class="product-price" {% if product.compare_at_price > product.price %} class="on-sale"{% endif %}>
        {{ product.price | money }}
      </span>

      {% if product.compare_at_price_max > product.price %}
        <span class="visuallyhidden price-a11y">{{ 'products.general.regular_price' | t }}</span>
        <del class="compare-price">{{ product.compare_at_price_max | money }}</del>
      {% endif %}
    </div>
  </div>
  {% endif %}

 

1 Like
Highlighted
New Member
1 0 0

where would I edit this code ? product price snippet ?

0 Likes
Highlighted

Hello @Joanne_Whitney 

 

Please check this Shopify App.  I guess it suits your requirments. 

Dropshippinghelps.com We Help Shopify Dropshippers
Hit Like If My Reply Helpful
Click Accept as Solution If My Reply Answered Your Question.
0 Likes
Highlighted
New Member
2 0 0

Hi florian6, if i want to have a price for paypal and cc and then a seperate button for a check price but it is hidden and needs to be signed in to click and check out with that option how would you advise i proceed. 

also would you be interested in helping me put this in place. I would gladly pay you for implementing this.

 

paradimecoins@gmail.com

0 Likes
Highlighted
Shopify Partner
26 2 5

We have achieved protected pricing with wholesale priority pricing and all customers must have a verified account ad be logged in. You can check out the project here:

https://growhaussupply.ca/

or https://www.2h.media/portfolio/growhaus-supply-co/

 

We are happy to help answer any questions. You can PM or email me at matthew@2h.media

 

2H Media is a full service marketing agency and Shopify partner based in Ontario, Canada.

 

Best regards,

Matthew

 

0 Likes