Add a customer login link to your theme

If you're using new customer accounts, and a login link doesn't display in your theme header for customers to login, then you can add a customer login link to your theme. Before you edit your theme code, review the considerations for customizing your theme.

Check for a login link on your theme

Many themes include login links by default. Before you proceed with this tutorial, check if login links are supported on your theme.

Steps:

  1. From your Shopify admin, go to Settings > Customer accounts.
  2. Turn on the Show login links toggle button.
  3. After you turn on login links, visit your online store as though you're a customer, and check for the profile icon in your store header to log in.
  4. If the profile icon doesn't display, then follow the steps to add a login link to your theme.

Add a login link to your theme

If a profile icon doesn't display in your online store header that lets customers log in to your store, then you can add a login link to your theme.

Steps:

  1. From your Shopify admin, go to Online Store > Themes.
  2. Find the theme you want to edit, click the button to open the actions menu, and then click Edit code.
  3. In the Sections folder, open the header.liquid file.
  4. Add the following snippet of code to the header.liquid file, and then click Save.
{% if customer %}
  <a href="{{ routes.account_url }}">Account</a>
{% else %}
  <a href="{{ routes.account_login_url }}">Login</a>
{% endif %}
Can’t find the answers you’re looking for? We’re here to help.