Hi all,
I am trying to limit this page to only my logged-in users, non logged-in users should be prompted to sign up for an account.
Is there way to do so?
A user wants to restrict a specific Shopify page so only logged-in customers can access it, with non-logged-in visitors prompted to sign up.
Proposed Solutions:
customer == nil and redirects accordinglyCurrent Status:
The discussion moved to private communication. One contributor offered to help implement the custom code solution after reviewing the user’s theme, and they exchanged contact information to continue troubleshooting directly via email.
Hi all,
I am trying to limit this page to only my logged-in users, non logged-in users should be prompted to sign up for an account.
Is there way to do so?
Hmmm. Shopify has a way to add redirects, but it looks like it redirects everyone. Shopify Help Center | URL redirects
Normally this should be done in the backend, but you can write a script that will redirect the user if they are not logged in with Liquid and JS.
Hi @AskTryTry ,
You can use a third-party app to hide the section from all visitors excluding the logged-in users. This will solve your issue with ease and prevent any frustrations or issues in the future.
Locksmith has been one of the most used apps for this. Give it a shot. Alternatively, you can look for other apps here.
Have a nice one!
You can also avoid using a third-party app and just write a few lines of code to either hide the section or redirect the user.
Here’s a test of it: redirect when not logged in – practice-agood
password: 1
Here’s the script
{% if customer == nil %}
# Redirecting, See you!
{% endif %}
Hi, thanks for the reply. I will message you.
Cool. Just do so and I’ll reply when I’m available.
Sorry, can’t seem to find a way to message you directly. Can I know where can I add your code to my page?
Click on my profile and you should see send a message button. Unfortunately, I need to look at your theme first before deciding where to add the code.
Doesn’t seem to have the option, can I get your email? Or could you email me at asktrytry@gmail.com please? Thank you!
Sent you an email. You can now remove your email in your message by editing it.