Re: Add a dynamic Login/logout text link on the Dawn theme

Solved

Add a dynamic Login/logout text link on the Dawn theme

Daymaker
Visitor
3 0 0

Hello, 

 

I would like to add a text link (vs. the theme's icon) that says LOGIN when a customer is not signed in and says LOGOUT when a customer is signed in. 

 

This will not go in the header where the default icon is. I will put it in another section. 

 

Can you help me with the liquid code to add this to a section of my choice?

 

TL;DR:

 

How do I create a dynamic login/logout link that says LOGIN or LOGOUT depending on the viewer's status that I can use elsewhere in the site besides the Header? 

 

Thank you!

Accepted Solution (1)

Ugurcan
Shopify Partner
348 7 34

This is an accepted solution.

you can start with this code:

{% if customer %}

<a href="/account/logout">Logout</a>

{% else %}

<a href="/account/login">Login</a>

{% endif %}
Pasilobus | eCommerce Experts, Shopify Apps & Development since 2015 -- www.pasilobus.com

View solution in original post

Replies 2 (2)

Ugurcan
Shopify Partner
348 7 34

This is an accepted solution.

you can start with this code:

{% if customer %}

<a href="/account/logout">Logout</a>

{% else %}

<a href="/account/login">Login</a>

{% endif %}
Pasilobus | eCommerce Experts, Shopify Apps & Development since 2015 -- www.pasilobus.com
Daymaker
Visitor
3 0 0

Thank you so much. I can't believe it was that easy.