Instead of attaching the onclick event in the html code (shoppingcart.cs) you'll want to do it at runtime like so
Code:
//Make the first shoe the default
$("document").ready(function() {
$("#addToCartControls .AddToCartButton").on("click", function() {doGoogleAnalyticsAdd();var selectedVariant = document.getElementById('variantSelect').value;ValidateVariant(selectedVariant, null);});
});
Make sure you're not replacing any pre-attached onclick functions as by default aspdnsf uses a few functions to validate the form when items are added to the cart. In my case, these are the lines of code
Code:
var selectedVariant = document.getElementById('variantSelect').value;ValidateVariant(selectedVariant, null);
found after my custom event function "doGoogleAnalyticsAdd".