How can I password protect a collection page using code?

Hi There

I am trying to set up the password-protecting collection page (only need to input passcode, no need to login), I know there are some apps supporting this function, but can I do this on the coding side?

My expected result:

User Group 1: passcode: 1234 to have permission to see link A

User Group 2: passcode: 2345 to have permission to see link B

etc

Thanks

Jess

@Jess_dia

{% if customer.has_account == true %}
     
        {% section 'collection' %}   
 
{% else %}
 

 
        
  
                    

                  

 
 
{{ pages.no-access.content }}
 
{% endif %}

Hello,

Welcome to Shopify Community.

You can try Like this code.

If you have any more issue, let me know.

Or if you want to make a custom password protected page you need to hire a developer.

Thank you.

@Jess_dia

yes you can manage customization customer base