I am looking for a solution about how to call a javascript function when an item is added to cart on shopify via ajax. Product can be added from homepage, collection-page or product-page.
I am trying with this method but not working for me. These changes i am doing within the theme files "theme.liquid, product.liquid, collection.liquid"
Everytime product go to cart alert should done.
Shopify.onItemAdded = function(line_item) {
alert('success');
};
scripts.js
(orscript.js
) file, and often times, there'll always be something like this already. Have a look. – HymnZzy