How to hide prices unless customers are logged in, Xtra template?

How to hide prices unless customers are logged in, Xtra template?

Bernman
Visitor
2 0 0

I'm currently working with the Xtra template and am looking to customize it so that prices are hidden throughout the template unless a customer has logged in. Could anyone familiar with this template advise me on where in the JSON structure I can make these modifications effectively?

Replies 3 (3)

JaviExpress
Shopify Partner
183 16 26

What files do you find if you search for "price" in the theme code files?

 

If price elements are clearly specified, you can wrap them in a conditional ({% if customer %}...{% endif %}) to show this content only when customer is logged in. We wrote an article for a similar customization, you can find it here.

 

Now I'm not sure if this would be the case for your paid theme Xtra

Customer Accounts Concierge
All-in-One Customer Portal: Profile, Orders, Loyalty, Referral, Wishlist, Custom Forms, Social Login
Bernman
Visitor
2 0 0

I only found "price" in a few locations for the theme code files, but this was a orders file. I have some featured products I'd like to remove and have narrowed down the files but cant seem to understand how the Xtra template displays their code. I'll definitely utilize the conditional in the article you provided once I find the exactl location.

Celtic_Well
Visitor
1 0 0

Sorry to jump on to this, but im needing to do the same with the Venture Theme.

This was set up previouly by someone else to make customers log in before they could access product pages, however if you search the product it bypasses the log in requirement - same if you google the product and go that way.  Ive had a look to edit the code but cannot get this to work, and now the requirement to log in has gone...

 

Does anyone have the standard code for the 'product-unit-price.liquid'?  So i can see what it should be and work from there?

Thanks