1jQuery(document).ready( function (e) { 2 3 4 // wc_checkout_params is required to continue, ensure the object exists 5 if ( typeof wc_checkout_params === 'undefined' ) 6 return false; 7 8 var updateTimer, 9 dirtyInput = false, 10 xhr; 11 12 jQuery(document).on('updated_checkout',function(){ 13 jQuery('.fee').on('click', function() { 14 if ( xhr ) xhr.abort(); 15 16 jQuery( '#order_methods, #order_review' ).block({ message: null, overlayCSS: { background: '#fff', backgroundSize: '16px 16px', opacity: 0.6 } }); 17 18 var data = { 19 action: 'woocommerce_update_order_review', 20 security: wc_checkout_params.update_order_review_nonce, 21 post_data: jQuery( 'form.checkout' ).serialize() 22 }; 23 24 xhr = jQuery.ajax({ 25 type: 'POST', 26 url: wc_checkout_params.wc_ajax_url.replace('%%endpoint%%','update_order_review'), 27 //url: wc_checkout_params.ajax_url, 28 data: data, 29 success: function( response ) { 30 if ( response ) { 31 if ( response.fragments ) { 32 jQuery.each( response.fragments, function ( key, value ) { 33 jQuery( key ).replaceWith( value ); 34 jQuery( key ).unblock(); 35 } ); 36 } 37 jQuery('#order_review').unblock(); 38 jQuery( '#order_methods, #order_review' ).find( 'input[name=payment_method]:checked' ).trigger('click'); 39 jQuery( 'body' ).trigger('updated_checkout' ); 40 } 41 } 42 }); 43 }); 44 }); 45 46 47}); 48 49 50jQuery(document).ready( function (e) { 51 // wc_cart_params is required to continue, ensure the object exists 52 if ( typeof wc_cart_params === 'undefined' ) 53 return false; 54 var updateTimer, 55 dirtyInput = false, 56 xhr; 57 jQuery(document).on('change','.fee', function() { 58 if ( xhr ) xhr.abort(); 59 60 jQuery( '.cart_totals' ).block({ message: null, overlayCSS: { background: '#fff', backgroundSize: '16px 16px', opacity: 0.6 } }); 61 var shipping_methods = []; 62 63 jQuery( 'select.shipping_method, input[name^=shipping_method][type=radio]:checked, input[name^=shipping_method][type=hidden]' ).each( function( index, input ) { 64 shipping_methods[ jQuery( this ).data( 'index' ) ] = jQuery( this ).val(); 65 } ); 66 if(jQuery('.fee').serialize() == ''){ 67 var fees = 'fees=false'; 68 }else{ 69 var fees = jQuery('.fee').serialize(); 70 } 71 var data = { 72 action: 'woocommerce_update_shipping_method', 73 security: wc_cart_params.update_shipping_method_nonce, 74 fees: fees, 75 shipping_method: shipping_methods, 76 }; 77 78 xhr = jQuery.ajax({ 79 type: 'POST', 80 url: wc_cart_params.wc_ajax_url.replace('%%endpoint%%','update_shipping_method'), 81 data: data, 82 success: function( response ) { 83 if ( response ) { 84 jQuery( 'div.cart_totals' ).replaceWith( response ); 85 jQuery('.cart_totals').unblock(); 86 jQuery( 'body' ).trigger('updated_shipping_method' ); 87 } 88 } 89 }); 90 }); 91});
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.