Re: How Can I check user logged in or not from theme extension script ?

Solved

How Can I check user logged in or not from theme extension script ?

masumluf
Excursionist
38 0 9

Hello Folks, I need to redirect to the user if they are not logged in from theme extension. Is there any way to identify whether an user logged in or not ? Thank you

Accepted Solution (1)

DivinityWebS
Shopify Partner
9 4 3

This is an accepted solution.

You can get this in two ways 1) By JavaScript Variable : If you do not get undefined value of ShopifyAnalytics.meta.page.customerId then user is logged in and variable returns customer id. 2) You can check by customer liquid object in top of liquid file of Theme Extension.

banned

View solution in original post

Replies 2 (2)

DivinityWebS
Shopify Partner
9 4 3

This is an accepted solution.

You can get this in two ways 1) By JavaScript Variable : If you do not get undefined value of ShopifyAnalytics.meta.page.customerId then user is logged in and variable returns customer id. 2) You can check by customer liquid object in top of liquid file of Theme Extension.

banned
CrashPhantom04
Shopify Partner
1 0 0

Awesome!