Can a cart_update webhook provide a session ID or similar?

Danh11
Shopify Partner
83 2 35

If I’m tracking a users behaviour across their session on a store, and they add an item to the cart which fires the cart update webhook, is there any way to link that incoming request to the customer so I can get update information about that customer in my app?

 

I guess if this is not possible, I’d have to setup events to listen for add/removal of items from cart. Would be nicer with the webhook if that could provide an identifier. 

 

I’ve tried to find docs for the cart update webhook but I can’t find any. 

Replies 2 (2)

Liam
Shopify Staff
2731 302 777

Hi Danh11,

 

Shopify's webhook payloads typically include all necessary identifiers required to find more information about the resources related to the event. For instance, a cart/update webhook should include the cart_id, which you can use to retrieve more information about the cart.

However, it's important to note that a cart is not directly linked to a customer until they proceed to checkout. Therefore, the cart/update webhook may not include any direct identifier to the customer.

 

If you need to track customers' activities, you may want to listen to the checkouts/create or checkouts/update webhooks instead. These webhooks are triggered when a customer reaches the checkout stage and they do include a customer_id field, which can be used to retrieve more information about the customer.

 

Unfortunately, as of now, Shopify does not provide a cart/update webhook. The available cart related webhooks are carts/create, carts/update and carts/destroy but they are only available for merchants on Shopify Plus.

 

If users of your app are not on Shopify Plus, you might need to set up your own event listeners on the storefront to track when items are added or removed from the cart, as you suggested.

 

Hope this helps!

Liam | Developer Advocate @ Shopify 
 - Was my reply helpful? Click Like to let me know! 
 - Was your question answered? Mark it as an Accepted Solution
 - To learn more visit Shopify.dev or the Shopify Web Design and Development Blog

Danh11
Shopify Partner
83 2 35

Ah ok - understood. I had noticed the those shopify plus webhooks in the graphiql explorer but had not realised they're for Plus stores only. Thanks!