php - Shopify - How to get customer e-mail from Cart webhook response?
I've found one topic mentioning this problem - customer Id not return in shopify cart webhook (https://stackoverflow.com/questions/45035204/customer-id-not-return-in-shopify-cart-webhook), but it doesn't help at all.
I really need to connect cart event with customer, I'm writing integration app and it is essential for implementing external events for my service, but I cannot get to the customer e-mail from cart hooks response. I thought that, I could get customerId from hook response, and then use it to GET customer e-mail using Shopify Api, but Cart webhook response DOESN'T even have customerId - wth? I thought about creating cookie, so I could connect event with customer, but I can't get to the cookies with hook whatsoever.
Is there any way to connect cart event with customer at all? Shouldn't it be just passed in the response, like in checkout hook?
The customer info is available client side from cookies. You know you can get the customer ID anyway, and use that to callback to the server and get the email using an API call.
Since the cart event in the webhook has a token value, have you tried matching that to the token value in the customer cookie? You might find a match there. If not, you're SOL.
Didn't find the answer?
Our community is visited by hundreds of Shopify development professionals every day. Ask your question and get a quick answer for free.
Find the answer in similar questions on our website.
Write quick answer
Do you know the answer to this question? Write a quick response to it. With your help, we will make our community stronger.