title: Shopify: How to call a Javascript function when a product is added to cart?
body: <p>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.</p>
  
  <p>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"</p>
  
  <pre><code>  Shopify.onItemAdded = function(cart) {
      alert('yass');
    };
  </code></pre>