I am developing an app to work together with a Shopify store. Since I will be adding custom JS code into the Shopify theme, I will be able to retrieve data such as value of secure_customer_sig cookie, as well as other cookies.
Also, I have access to use the REST API of that specific store.
My question is, is there any way I can retrieve customer details through that API using one of the cookie values such as secure_customer_sig. I would basically need to get an ID and Email of the customer that is logged in.
Hey @CVPirke ,
A few points:
1) You will not be able to make calls to the Shopify REST Admin API from the front-end browser, if that is what you are looking to accomplish. You will be blocked by CORS policy if you try to make calls to the Shopify REST Admin API from the front-end. You can only make calls to this API from a back-end app
2) You cannot read the customer ID from the secure_customer_sig cookie as far as I know, but you can use Liquid to get the customer ID: https://help.shopify.com/en/themes/liquid/objects/customer ... Similarly you can also use the Shopify Storefront API to get the customer ID and email: https://help.shopify.com/en/api/storefront-api/reference
Hassain | Developer Support Specialist @ Shopify
- Was my reply helpful? Click Like to let me know!
- Was your question answered? Click Accept as Solution
Have you created a collection on your online store and experienced an issue with adding yo...By Ollie Aug 24, 2022
Connect your PayPal account to allow your customers to checkout using the PayPal gateway a...By Ollie Jul 28, 2022