问题
The Shopify cart webhook is not returning customer id. so we can't able to identify which user added the product to cart.
How can we achieve this?
回答1:
I think you can't get the customer id from that webhook and the point is that a cart can be created by a registered customer or an unregistered customer as well so in this last case Shopify doesn't know the customer id yet.
Also the example response included in the documentation doesn't include the customer id.
{
"id": "eeafa272cebfd4b22385bc4b645e762c",
"token": "eeafa272cebfd4b22385bc4b645e762c",
"line_items": [
{
"id": 1234567,
"properties": {
},
"quantity": 3,
"variant_id": 1234567,
"key": "1234567:f816dcc3b2e26822a28626a786eac953",
"title": "Example T-Shirt - ",
"price": "19.99",
"original_price": "19.99",
"discounted_price": "19.99",
"line_price": "59.97",
"original_line_price": "59.97",
"total_discount": "0.00",
"discounts": [
],
"sku": "example-shirt-s",
"grams": 200,
"vendor": "Acme",
"product_id": 327475578523353102,
"gift_card": false
}
]
}
You can probably get the customer id using the checkout webhook but without knowing your requirements I can't say this will work for you.
I recommend you to open another question and provide more information on your requirement.
来源:https://stackoverflow.com/questions/45035204/customer-id-not-return-in-shopify-cart-webhook