Hide profile icon in header if not signed in?

I’m trying to hide the icon of the little person next to the cart icon in my store. I’m using the Lorenza theme. Ideally, I’d like to hide the profile icon unless someone is already signed in but if I don’t have a way to qualify that then I’m ok hiding it all the time. I tried using the code:

.header__icon header__icon–account {
display: none!important;
}

and it didn’t work. What am I doing wrong?

Store: https://66cdcb-86.myshopify.com/

Password: chohme

Hello @jasminsharp97

You can add code by following these steps

  1. Go to Online Store → Theme → Edit code.

  2. Open your theme.liquid file

  3. Paste the below code before on theme.liquid

@media (min-width: 60em) { .header--default .header__icon--account{ display: none !important; } }

my reply helpful? Click Like to let me know!
your question answered? Mark it as an Accepted Solution.

Hi @jasminsharp97 ,

  1. Go to Online Store → Theme → Edit code.
  2. Open your theme.liquid file
  3. In theme.liquid, paste the below code before

If my reply is helpful, kindly click like and mark it as an accepted solution.

Thanks!

.header__icon.header__icon--account {
display: none!important;
}

Can you try this code @jasminsharp97

@jasminsharp97 you can place the following code in the theme.liquid file before the closing -Tag

{% unless customer %}

{% endunless %}

Hiding the Icon will only apply to those who are not logged in.

2 Likes

Step 1: Go to Shopify Admin → Online Store ->Theme → Edit code

Step 2: Search file theme.liquid

Step 3: Insert this code above tag:

{% unless customer %}
  
{% endunless %}

Hi @jasminsharp97 for the answers using the liquid conditions, if the theme has it use a site wide custom-liquid section or block if possible instead of editing theme code directly to not break automatic theme upgradability.

If available site wide would often be either in the header or footer section groups in the theme visual editor.