hide pricing unless logged in

New Member
3 0 1

I am trying to hide the pricing unless a customer is logged in.   I found some other topics on this but still having issues on hiding the product.  The code I found to add but i need to alter is:

 

{% if customer %}
<li>
<span id="productPrice-{{ section.id }}" class="h1">
{% include 'price' with variant.price %}
</span>
</li>
{% endif %}

 

 

The pricing section on my template is:

 

<!-- pricing -->
<span class="sold_out hidden">{{ 'Sold Out' }}</span>
<span class="was_price money hidden">
</span>
<span class="current_price money">
</span>
{% if section.settings.display_savings %}
<span class="sale savings" style="display: none;">
{{ 'products.product.savings' | t }} <span class="save_percentage"></span> (<span class="money save_amount"></span>)
</span>
{% endif %}
</p>
<!-- end pricing -->

 

 

Are there any suggestions on how to alter the added code to hide the pricing.

 

Thanks,

 

 

0 Likes
Astronaut
1082 147 272

use an if statement with the customer object:

 

{% if customer %}

//pricing code

{% else %}

//whever you want to show everyone who isnt a customer

{% endif %}
If you'd like to make any edits to your store, please send me a personal message and we can discuss what you'd like to accomplish :D
0 Likes