Happening now | Office Hours: Customizing Your Theme With Moeed | Ask your questions now!

Re: How To Put Customer Name On Header When Logged In On Focal Theme

How To Put Customer Name On Header When Logged In On Focal Theme

KD520
Tourist
10 0 1

Hi,

Is there an option or maybe some code you could help me with that could help me display customer name as "Hello, <customer name>" when logged in rather than displaying "account".

The theme I'm using is Focal Theme.

Thank you! 

Reply 1 (1)

Small_Task_Help
Shopify Partner
1103 51 108

Hi,

 

First take backup

At Edit code>header.liquid

 

First, you need to check if the customer is logged in. If they are, you can display their name; if not, you can display a login link. The Liquid code might look something like this:

 

<div class="customer-info">
  {% if customer %}
    <p>Welcome, {{ customer.first_name }}!</p>
  {% else %}
    <p><a href="/account/login">Log in</a></p>
  {% endif %}
</div>

Save and test, if all ok then publish. If you still need help then you can contact us.

To Get Shopify Experts Help, Click Here or E-mail - hi@ecommercesmalltask.com
About Us - We are Shopify Expert India
At Google My Business - Ecommerce Small Task - Hire Shopify Developers Ahmedabad