jQuery( document ).ready(function() {
	
	var id_of_div = jQuery('.product.type-product span.woocommerce-Price-amount bdi').html();
	if(id_of_div != undefined){
		var total = id_of_div.split("span")[2];
		var product_price = total.substring(1, total.length).replace(/\,/g,'');
		jQuery('.modifier_field_select').change(function(){
			var calculated_modifier_price = 0;
			var modifier_price = 0;
			var mod_pricess = [];
			jQuery('.modifier_field_select').each(function( index ) {
				var item=jQuery(this);
				if(item.val()){
					modifier_price = +modifier_price + +item.val().split('|')[1];
				}
			});
			var calculated_modifier_price  = +product_price + +modifier_price;
			updated_product_price = jQuery('.woocommerce-Price-currencySymbol').html()+ calculated_modifier_price.toString().replace(/\B(?=(\d{3})+(?!\d))/g, ",");
			jQuery('#calculated_mod_price').html(updated_product_price);
		});
	}
    jQuery('.single_add_to_cart_button ').on('submit', '.cart',  function(e) {
        e.preventDefault();
        if (jQuery('input, select').not('[type="button"]').filter(function() {
                return this.value!="";
            }).length) {
            //$("#myForm").submit()
        }
    });
});