How can I display a logged-in customer's name on our page?

I have the following question. Is it possible to show the costumer’s name in our page when he logs in? When a costumer logs in, he should be able to watch his name instead of “My account” link.

I tried to add {{first_name}} and {{customer.first_name}} in shopify language editor. But no success.

Thank you in advance,
Nuno Rodrigues

Hi @nunorodrigues

I have add {{customer.first_name}} to display first name of customer and it’s working for me. Could you please verify your code once?

{%- if customer -%}
  {{ customer.first_name }}
{%- else -%}
  {% render 'icon-account' %}
{%- endif -%}

I hope it’s helpful to you.

1 Like