New Shopify Certification now available: Liquid Storefronts for Theme Developers

Seeking alternative method to retrieve customer ID without email and password

Shopify Partner
3 0 0

Hello Shopify Community,

I am currently working on a checkout UI extension using React in Shopify. In my extension, I
need to retrieve the customer ID during the checkout process. However, I do not have access
to customer emails and passwords for security reasons.

I have reviewed the Shopify documentation, and the recommended method to obtain the customer ID is by using the customerAccessTokenCreate mutation, which requires the customer's email and password. Unfortunately, this approach is not feasible for my use case.

I would like to know if there are any alternative methods or suggestions to retrieve the
customer ID without relying on customer emails and passwords. Is there any other API
endpoint or approach that I could use to achieve this?

Any guidance, insights, or examples would be greatly appreciated.

Thank you in advance for your help!

Reply 1 (1)
Shopify Staff
Shopify Staff
246 57 62

Hi there! 👋

If you are building a Checkout UI extension with React, I would recommend reviewing the available react hooks

The `useCustomer` hook will return the logged in customer's information, including the ID!

We don't currently have a tutorial that uses the `useCustomer` hook, but this tutorial uses the `useOrder` hook, which is used in a similar way.
Hope that works for your use case!

To learn more visit the Shopify Help Center or the Community Blog.