I have been trying to figure out how to Calculate a Shipping cost based on Quantity and I think I have found a solution using jQuery. Here it is if anyone wants to use it or optimize it:
$('.ginput_quantity').keyup(function() {
var sum = 0;
$('.ginput_quantity').each(function() {
sum += Number($(this).val() * .50);
});
$('.gfield_shipping .gform_hidden').attr('value',parseFloat(sum).toFixed(2));
});
I have a list of Products with the Quantity field attached (by default) and want to add a $.50 cent per Quantity shipping cost to the total order. This jQuery snippet adds the total Quantity value and multiplies it by .5 and then places that value in the hidden input of the Shipping field.
Since I am a newbie at jQuery, I'm sure there is a better to do this and would love to hear about it.
Thanks