Re: Login to view prices! HELP

How can I force customers to login to see prices in my ecommerce design?

OEMIndustries
Tourist
14 0 1

I need help with the code in shopify design to force customers to login to view pricing on my product pages.

All of the apps I have tried conflict with other programs on my site so that is not an options.

I currently have the pricing hidden because I do not want non-logged in customers to see the pricing. 

 

Website is https://www.oemcatalyticconverters.com/

Replies 20 (20)

PaulNewton
Shopify Partner
7450 656 1561

Hi @OEMIndustries 

Important PSA: for the online sales channel any published products prices are viewable through the AJAX api i.e. /products/product-handle.json .

 And often most themes have schema data, etc that put the price into the html-source itself though removing pricing there can undermine SEO.

The only way to fully remove shopify product-price data from a frontend is by creating your own custom storefront as a custom frontend stack that you host and maintain.

 

 

Have you tried the locksmith app that's pretty much the goto for access control scenarios, aka content-gating.

 

There's also tons of posts on toggling the visibility of elements , such as prices, by using CSS triggered by customer tags. Though note that's just visibility the price is still there for clever users to simply show again with CSS.

There's also shopify unsupport advanced customization that forces redirects to login:

https://community.shopify.com/c/shopify-design/site-access-create-a-members-only-store/m-p/613500?ut... 

 

If you need this customization explored you can contact me by mail for services.
Please always provide context, examples: store url, theme name, post url(s) , or any further detail.
Contact Info in signature.

Contact paull.newton+shopifyforum@gmail.com for the solutions you need


Save time & money ,Ask Questions The Smart Way


Problem Solved? ✔Accept and Like solutions to help future merchants

Answers powered by coffee Thank Paul with a Coffee for more answers or donate to eff.org


OEMIndustries
Tourist
14 0 1

Hi if you read my post I stated "All of the apps I have tried conflict with other programs on my site so that is not an options."

JaviExpress
Shopify Partner
183 16 26

Hey there.

 

If you want a clean solution and without apps I think you should implement the solution directly in the code, just wrap the 'price' elements in a condition to only show when the customer is logged in. At the same time you can add a different content when the customer is unlogged. It'd go like this:

 

{% if customer %}
--price snippet or container--
{% else %}
<b>Please login to see the price</b>
{% endif %}

Customer Accounts Concierge
All-in-One Customer Portal: Profile, Orders, Loyalty, Referral, Wishlist, Custom Forms, Social Login
OEMIndustries
Tourist
14 0 1

Where do I place this code? Can you give me an example of what it would look like?

PaulNewton
Shopify Partner
7450 656 1561

You would wrap it pretty much around every piece of logic/html that outputs the things you want to hide.

For example in Dawn based themes you'd wrap the render/output of the price block

https://github.com/Shopify/dawn/blob/main/sections/main-product.liquid#L101C17-L106C20 

 

Or target it with CSS in a custom-liquid block/section in the visual theme editor.

Styling to need.

{% if customer %}
{% else %}
<style>
.price:after {
 content:"Please login to view prices."
 display: block;
}
.price__container { display: none;}
</style>
{% endif %}

 

Contact paull.newton+shopifyforum@gmail.com for the solutions you need


Save time & money ,Ask Questions The Smart Way


Problem Solved? ✔Accept and Like solutions to help future merchants

Answers powered by coffee Thank Paul with a Coffee for more answers or donate to eff.org


OEMIndustries
Tourist
14 0 1

That did not work unfortunately, I am seeing this under product_main.liquid, any recommendations? 

 

OEMIndustries_0-1692201531282.png

 

JaviExpress
Shopify Partner
183 16 26

Hi @OEMIndustries 

 

Probably you also want to hide the Add to Cart actions to unlogged visitors, otherwise the price could be shown in the cart.

 

We thought it was a subject interesting enough so we are preparing an article here. This is still under construction so we can't guarantee it's a great article at this point. The solution would also depend on other factors like theme customizations, or other apps that could be adding price elements.

 

Anyway you are more than welcome to read the article and give us a feedback. You can also contact us through the Contact page in the blog.

Customer Accounts Concierge
All-in-One Customer Portal: Profile, Orders, Loyalty, Referral, Wishlist, Custom Forms, Social Login
OEMIndustries
Tourist
14 0 1

I am getting an error code, what would it look like here?Screenshot 2023-08-17 101011.png

JaviExpress
Shopify Partner
183 16 26

Hi.

 

We don't see any of our code in your picture, or any error flag, so it's difficult to know.

 

Is that a picture of your price snippet? How is it named? Which theme are you using?

Customer Accounts Concierge
All-in-One Customer Portal: Profile, Orders, Loyalty, Referral, Wishlist, Custom Forms, Social Login
OEMIndustries
Tourist
14 0 1

I did not add your code to that snippet, I am asking where to place it

JaviExpress
Shopify Partner
183 16 26

there's a link in my last post, will take you to an article. if you have questions about the content in the article let me know. best

Customer Accounts Concierge
All-in-One Customer Portal: Profile, Orders, Loyalty, Referral, Wishlist, Custom Forms, Social Login
OptegoVision
Excursionist
22 0 27

@JaviExpress I read your article and added the code to the product-price.liquid file, it works perfectly.  However I do want to hide the quantity selector and add to cart button as well, as if you aren't logged in you can still add the product to the cart and see the price.  Do you have a solution for this?

 

OptegoVision_0-1697822211448.png

 

JaviExpress
Shopify Partner
183 16 26

Hi there @OptegoVision , glad you liked the article.

 

The ending of the code contains a simple CSS rule to hide which in most cases is the element containing the Add to Cart form

 

JaviExpress_0-1697882853903.png

 

Probably this element has a different name in your theme so you'd need to adapt the rule to it. Let me know your URL and I'll check which could be the right one, also for the quantity selector

Customer Accounts Concierge
All-in-One Customer Portal: Profile, Orders, Loyalty, Referral, Wishlist, Custom Forms, Social Login
OptegoVision
Excursionist
22 0 27

@JaviExpress thank you so much for the help.

URL: https://e2d28c-2.myshopify.com/

PW: stiech

JaviExpress
Shopify Partner
183 16 26

No problem

 

I see you have different product pages. Try this at the end, instead of what you can find in the article, to hide those different elements:

 

{% comment %} END CUSTOMER CONDITIONAL {% endcomment %} {% else %} <a href="/account/login">Please login to see the price</a>

<style>form[action="/cart/add"], .product__block__quantity { display: none !important; }</style>

{% endif %}

Customer Accounts Concierge
All-in-One Customer Portal: Profile, Orders, Loyalty, Referral, Wishlist, Custom Forms, Social Login
OptegoVision
Excursionist
22 0 27

@JaviExpress that worked perfectly on the product pages, however the pricing is still showing on the collection pages and the home page.  Can you help with that?

 

OptegoVision_0-1698074354024.png

 

OptegoVision_1-1698074372312.png

OptegoVision_2-1698074401335.png

 

Andrecolap
Excursionist
48 0 5

hello @JaviExpress I am interested in this customization for my website and I would have liked to read your article about it but I couldn't find it at the link you pasted in one of your messages above, which I am pasting below:

https://www.froonze.com/blog/how-to-hide-prices-to-unlogged-customers-in-shopify

All I would like to have is to hide the prices and have instead a prompt to log in or to create an account to see the prices of my items, add them to the cart and buy them.

I don't know how to code but I changed a number of codes to my website following other posts on here and on youtube, so it would be great if I could have some guidance on how to do this as well.

Thanks

Andrea

PaulNewton
Shopify Partner
7450 656 1561

I did read the post there are lots of apps, "all of the apps I've tried " doesn't mean all apps ever.

Contact paull.newton+shopifyforum@gmail.com for the solutions you need


Save time & money ,Ask Questions The Smart Way


Problem Solved? ✔Accept and Like solutions to help future merchants

Answers powered by coffee Thank Paul with a Coffee for more answers or donate to eff.org


PaulNewton
Shopify Partner
7450 656 1561

Also see this similar recent post

https://community.shopify.com/c/shopify-discussions/change-story-to-professional-only/td-p/2176369 

Contact paull.newton+shopifyforum@gmail.com for the solutions you need


Save time & money ,Ask Questions The Smart Way


Problem Solved? ✔Accept and Like solutions to help future merchants

Answers powered by coffee Thank Paul with a Coffee for more answers or donate to eff.org


magecomp
Shopify Partner
450 31 45

Hello @OEMIndustries 

 

You can try below apps

https://apps.shopify.com/rfq-request-quote-hide-price

https://apps.shopify.com/required-login-for-customers? 

Helping voluntarily. Please like and accept the solution if it helps. Thanks!
Our Bestseller Shopify Apps    |      Mobile App Builder by MageComp    |      Shoplock Hide Pages/Collections

Need a developer?  Just visit MageComp website