Our Partner & Developer boards on the community are moving to a brand new home: the .dev community forums! While you can still access past discussions here, for all your future app and storefront building questions, head over to the new forums.

how to create the store front event like add to cart data push to the app using the webhook.

how to create the store front event like add to cart data push to the app using the webhook.

Not applicable

how to create the storefront event like add to cart data push to the app using the webhook.
how to create a webhook listener in backend ?

Reply 1 (1)

Liam
Community Manager
3108 344 899

Hi Hashcode_io,

 

One way you could achieve this would be to add a custom JavaScript script to the Shopify theme that will listen for the "Add to Cart" button click event (which might require using the Asset API). When the event occurs, it captures the necessary data (like product ID, quantity, etc.) and you could use an AJAX call to send this data to a specific endpoint on your server. Then you'd create an endpoint in your backend application. This endpoint will be the URL to which the AJAX call sends the "Add to Cart" data. Finally you could write logic to handle the incoming JSON data (parse it, validate, etc.).

 

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