App reviews, troubleshooting, and recommendations
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/
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:
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
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."
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 %}
Where do I place this code? Can you give me an example of what it would look like?
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
That did not work unfortunately, I am seeing this under product_main.liquid, any recommendations?
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.
I am getting an error code, what would it look like here?
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?
I did not add your code to that snippet, I am asking where to place it
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
@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?
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
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
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 %}
@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?
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
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
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
Hello @OEMIndustries
You can try below apps
https://apps.shopify.com/rfq-request-quote-hide-price
https://apps.shopify.com/required-login-for-customers?
We recently spoke with Zopi developers @Zopi about how dropshipping businesses can enha...
By JasonH Oct 23, 2024A big shout out to all of the merchants who participated in our AMA with 2H Media: Holi...
By Jacqui Oct 21, 2024We want to take a moment to celebrate the incredible ways you all engage with the Shopi...
By JasonH Oct 15, 2024