In my app, I want to retrieve the current logged-in customer ID. I have used {{customer.id}} in Liquid, but it is not working. Does anyone know how to obtain this ID?
Topic summary
A developer needs to retrieve the currently logged-in customer ID in their Shopify app. Their initial attempt using Liquid syntax ({{customer.id}}) is not working.
Proposed Solution:
- Use Shopify’s app proxy feature, which automatically returns
logged_in_customer_idwith each response - This ID can then be used with the Shopify API to fetch customer data
- Documentation link provided for displaying dynamic store data with app proxies
Follow-up Questions:
- The original poster is new to Shopify and unfamiliar with proxies
- Concerns about potential performance impact of implementing a proxy
- Requesting guidance on setup process and whether alternative methods exist
The discussion remains open, awaiting clarification on proxy implementation best practices and potential alternatives.
Hello,
Assuming you are using a proxy request then Shopify will return ‘logged_in_customer_id’ with each response. You can then use the api to fetch the customer with the id
Hello Jordan,
I’m new to Shopify and currently not using a proxy. Will this have any impact on my app’s performance? Are there any alternative methods available? If using a proxy is indeed the best approach, could you please guide me on setting up a proxy in my app?