whenever a customer opens my site, how can I send them across the direct login page?

whenever a customer opens my site, how can I send them across the direct login page?

Hi

Thanks for posting on Shopify Community. I would love to help you today.

I have a question about your requirement. Do you want to redirect new and log outed customers to the login page?

If that, then it’s need to write some logical liquid code and javascript code. Please let me know, I will try to send you the codes.

Thank you.

Hi @sakinur-rahman

I have to do that, I just turn on the status in the database then the user opens my site then the direct login page should open. And if I close the status, the direct home page should open. But I’m confused as to which file of the theme I would put even if I coded it?

There many things need to be done to make that functionality.

It’s not possible describe by writing here but it’s possible.

Do you have any idea that if I do everything else, I will have to put code in which file of Theme?

You need code on the theme.liquid template directly and settings_schema.json file for making option to enable and disable.

the final code would be like this :

{% if !customer and settings.enable_redirect == true %}

Redirect the custom to login page by javascripts.

{% %}

How can I use liquid Route inside if condition? Even if I use the window location then the page rotates continuously. and the route did not work, I simply tried this code for testing

{% if customer %}

{%else%}

{% endif %}

I tried putting code in head and body in the theme file but it doesn’t work.