Quantcast
Channel: Opinion: Shopify Community - Wholesale & Dropshipping
Viewing all articles
Browse latest Browse all 6215

Nile commented on Looking for way to have pricing hidden unless logged in

$
0
0

Andrew, I think you’ve got it backwards. 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-before-user-signs-in-118320) also has the answer backwards, in the same fashion.


Viewing all articles
Browse latest Browse all 6215

Trending Articles