New Shopify Certification now available: Liquid Storefronts for Theme Developers

Fetch logged in customer id for my node js app

Solved
Y4TO
Shopify Partner
12 2 0

Hello. 
I'm trying to get customer id of logged in user. I have managed to display the customer id on frontend but i'm clueless as to how i can get it in my app.

I'm using 

<script type="text/javascript"> window.customerId = "{{ customer.id }}"; </script>

 

is there anyway i can send this customer id to my node js app? what do i need to call to get this id? I'm sort of new to shopify app dev

 

Thank you.

Ahmed Vohra
You can email me at: ahmedvohra1@hotmail.com

Hire me on upwork
Accepted Solution (1)
Y4TO
Shopify Partner
12 2 0

This is an accepted solution.

For anyone who is reading, I was able to accomplish this by using 'Theme-app-extention' in my app and added Post request for the customer id using App proxy. 

Ahmed Vohra
You can email me at: ahmedvohra1@hotmail.com

Hire me on upwork

View solution in original post

Replies 2 (2)
Y4TO
Shopify Partner
12 2 0

I understand I need to use 'App proxy' to achieve this. I am a little bit confused on how to set up an app proxy and make the call ? I read the documentation https://shopify.dev/apps/online-store/app-proxies#handling-proxy-requests But I'm still not clear on how to do it.

Ahmed Vohra
You can email me at: ahmedvohra1@hotmail.com

Hire me on upwork
Y4TO
Shopify Partner
12 2 0

This is an accepted solution.

For anyone who is reading, I was able to accomplish this by using 'Theme-app-extention' in my app and added Post request for the customer id using App proxy. 

Ahmed Vohra
You can email me at: ahmedvohra1@hotmail.com

Hire me on upwork