Customer liquid object not working on new accounts

There seems to be still an issue where the liquid customer object is blank even after logging in.
This creates some issues with code that displays content depending on if a customer is logged in.
From simple things like menu icons to b2b information.

I found other people talking about it without getting a solution or response.
Example old forums

I couldn’t find anything here about this problem but it seems to still persist till today.

Is there a better solution to this than use the old customer accounts for the time beeing?

Hi @Christian_Schneider
Do you use a custom theme or one of the Shopify themes? I tried to replicate this issue on my end and I couldn’t.
I changed the version of customer accounts to the new one which is Customer accounts

Then I simply added this code to the header.

{% if customer %}
    Hello, {{ customer.first_name }}!
  {% endif %}

And then


after I logged in I could see the changes.

Hello @Eugene_Kasimov
Good question.
We use a customised version of the Local theme.
To test this I added a clean Local theme without changes and a Dawn theme to the store and tested the same code you used, just to be sure:

{% if customer %}
    Hello, {{ customer.first_name }}!
 {% endif %}

Both themes show the same Issue. I tested different browsers: edge, chrome, opera & firefox. I’ve also gotten a friend of mine who hasn’t interacted with the store to test this. She confirmed the issue.

Testing this on a different store with the same theme has no problems.

No apps were installed on both stores during the tests.

Now the other thing I should mention is that this worked fine for me for months and stopped working two-three weeks ago while no one was working on this store at the time.(Its a side project and I am the only person assigned to it)

The strange thing is it worked until last friday for my boss and stopped working on monday.

It seems the bug only appears after time or a trigger and does not appear right away.

So, as far as I understand this issue appears only on one store, is it correct? As you mentioned, when you tested the same themes on another store there was no issue.

I dont have the solution, but just for testing purposes did I install a clean Dawn theme on a fresh store, and added the following code:

      <h1>
        {% if customer %}
          Hello {{ customer.name }}
        {% else %}
          Hello unknown!
        {% endif %}
      </h1>

On both Customer Accounts versions it worked as expected.

@Eugene_Kasimov Yes. As far as I can tell its only this store. The others who have new customer accounts enabled are normal.

@curzey Yes. I have tried to replicate it, too, with no success.

@curzey @Eugene_Kasimov
Well the old tech support solution worked again:
Turning it off and on again solved the issue.

Specifically changing from new to old accounts and back again.

1 Like

Hello @Christian_Schneider , I experience the same issue, I have switched to new customer accounts months ago and, from time to time, the customer object is null. Did you find any concrete solution to this? always monitoring if it works from time to time and switching on and off the new customer accounts seems not sustainable at all. Did you notice, since your last post, that the object at some point was null again? I notice that , if i log into the store at some point, and come back later/after some days (still logged in), the object is returned null. If i log off and then log back in in that particular session, the issue is fixed

1 Like

Yes one of my clients store is having the same issue. They have videos (coming from metaobjects) that are linked to the customer that customers can’t see because the object is null (and they need to be logged in to see them)

Do we have a solution to this?

I have exact same issue, its a devs store, and I am working on one shopify app, where I have one extension that required customer to be logged in to use some features, and I have to log out and login again every next day when i start work.

I believe this issue is the same issue as raised in these threads:

Currently sitting with Shopify to clarify, but it appears as if the logged in cookie is only stored in the storefront for a short period of time, after which time expires and the session is then only available on the Customer Account domain.