Restrict page to logged-in users only

Topic summary

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:

  • Third-party apps: Locksmith is recommended as a popular option for hiding content from non-logged-in users without coding
  • Custom code approach: A few lines of Liquid code can redirect or hide sections for non-logged-in users. A working example was shared that checks if customer == nil and redirects accordingly

Current 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.

Summarized with AI on November 12. AI used: claude-sonnet-4-5-20250929.

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?

Link: https://trytrysg.myshopify.com/pages/share-review

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.

1 Like

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.

1 Like

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 %}
3 Likes

Hi, thanks for the reply. I will message you.

1 Like

Cool. Just do so and I’ll reply when I’m available.

1 Like

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.

1 Like

Doesn’t seem to have the option, can I get your email? Or could you email me at asktrytry@gmail.com please? Thank you!

1 Like

Sent you an email. You can now remove your email in your message by editing it.

1 Like