How to Put Customer name on header when logged in?

majority of my pages are from ecom solid . Im having trouble finding a way to make the account icon in header display Hi,(Customer Name) with a small logout button below .

Can anyone help ?

Hi @SixTrads ,

Please go to header.liquid file, find ‘if customer’ and add code:

Hi, {{ customer.name }}

This code needs to show up in ‘if customer’

If you still can’t change it, please send me the code of header.liquid file and site link. I will check and guide you in detail.

Hope it helps!

1 Like

Hi ive tried putting the code no luck yet . i have also noticed there is no account name shown in account page as well and having trouble finding out how to edit the accounts page aswell

Here is the site . its still under development


  

    {% include 'drawer-menu' %}
  

  
    

      {% if section.settings.show_announcement %}
        {% if section.settings.home_page_only == false or request.page_type == 'index' %}
          

          {% if section.settings.link == blank %}
            
          {% else %}
            
          {% endif %}

            

{{ section.settings.text | escape }}

          {% if section.settings.link == blank %}
            

          {% else %}
            
          {% endif %}

        {% endif %}
      {% endif %}

      

      
    

  

Hi @SixTrads ,

It’s supported by Shopify, so I don’t think it doesn’t work. Refer https://shopify.dev/api/liquid/objects/customer

Can you try other Attributes?

If all is not showing, most likely the place where you added the code is not correct, you can check it again.

Hope it helps!

This is the code and this is where i inserted it .. is that wrong?

{% if shop.customer_accounts_enabled %}
                  - {% if customer %}                          
                          						                       	
                              Hi, {{ customer.first_name }} 
                            {% else %}
                              {{ 'layout.customer.log_in' | t }}
                            {% endif %}
                        
                      
                    
                  
                {% endif %}

@SixTrads Add this code on the top of the ‘Account icon file’

{{ customer.first_name }}

Hi @SixTrads ,

I have checked and the code you submitted is not showing the same as the site you submitted. So code can be generated by ‘ecom solid’, you need to change in this, not in header.liquid file.

Can you send me the generating code of ‘ecom solid’ or staff account, I will check it

Hi SixTrads! This is Anna from EcomSolid Customer Success Team. Thank you so much for bringing up your concern to our attention! Let me walk you through it.

  1. First of all, you need to set up to make the account icon visible in the header first. Please turn on the “Account” option in the header in the theme editor and set up these settings in Shopify Admin: Go to Settings >> Checkout >> Customer Account >> Select “Accounts are optional”.

  2. We can customize the code in our backend to so that the text “Hi, (Customer Name)” can display next to the Account icon. In order to process this kind of custom task, I’d strongly recommend that you may reach our team via our Support Chat Box in your EcomSolid main dashboard for the best advice. We’re waiting for you over there.

  3. If you would like the text “Hi, (Customer Name)” display above Logout button, that kind of preset is not available in the theme at the moment; nevertheless, you’re suggested to reach our Support Team with a demo (eg: Store URLs) which demonstrates your idea; then our Tech experts will check to see how far we can help with it and give the best solution.

We can’t wait to catch up with you in our Support Chat Box. Thank you so much for your cooperation!

i chat box dont work maybe because im on free version

what code do you need ecom solid is everywhere

SixTrads, Support Chat Box is available for all kinds of plan. For now, please kindly check if there’s any Ads Block extensions/ plugins which are running in your browser, if yes, please disable them as they block the script of our Support Chat Box so that you can’t see it on your end.

We may need to check your theme directly to provide the proper solution for your case because the custom code may need to be optimized to make it work smoothly in your store without unexpected bugs.

Hi @SixTrads ,

Header display code. But not in header.liquid file, it’s in ‘ecom solid’

Here is another solution.

Providing that you have customer activated in settings, you can paste the code where I am showing it in header.liguid. You should already have the account icon in your header and this will place the “Hi, customer name” to the right of it. The line number is not going to be the same in all accounts. Mine was at line number 640 about.

Place this code:

{%- if customer -%}

{% render 'customer-name' %}
{%- endif -%}

In between the code segments as shown here:

{%- if shop.customer_accounts_enabled -%}

{% render ‘icon-account’ %}

{%- liquid
if customer
echo ‘customer.account_fallback’ | t
else
echo ‘customer.log_in’ | t
endif
-%}


{%- endif -%}


{%- if customer -%}

{% render 'customer-name' %}
{%- endif -%}
{%- liquid if cart == empty render 'icon-cart-empty' else render 'icon-cart' endif -%} {{ 'templates.cart.cart' | t }} {%- if cart != empty -%}
{%- if cart.item_count < 100 -%} {{ cart.item_count }} {%- endif -%} {{ 'sections.header.cart_count' | t: count: cart.item_count }}
{%- endif -%}

Then create a new snippet. Label it “customer-name” and paste the following code in it.

{%- if customer -%}
Hi, {{ customer.name }}
{%- endif -%}

3 Likes

This worked as expected. Thanks a lot!

Hi Harry

Thanks for your code and its work great, but the name is not in line with the icon, pic below as ref, are we able to adjust it?

Appricate your help

acc.PNG

##- Please type your reply above this line –##

Shoot that code back to me and a screen shot so that I know for sure what you mean. I didn’t write that code but if what you are asking is a simple change in the HTML, I might be able to help you, especially since if I can, it won’t take but a minute.

Thank you very much.

You so helded me, I inserto the account icon too.
As the attach print screen.

So you are all set then? This is the first I have come back here and looked at the code. I used to be pretty proficient with HTML, forgot most of it. I can see now that I didn’t write any of that because it’s not basic HTML. I at one time knew just very little java script writing. I got that code elsewhere and was happy that I could share it and help you. I probably would need to take hours if there was more that you hope for and even then wonder if I could make a difference.

Cheers