1function afUpOrder() 2{ 3 "use strict"; 4 5 jQuery( 'body' ).trigger( 'update_checkout' ); 6} 7 8jQuery( document ).ready(function($){ 9 10 $(document).on('blur', '#aftax_vat_field_checkout', function handler() { 11 $(document).off('blur', '#aftax_vat_field_checkout'); 12 13 $('body').trigger('update_checkout'); 14 15 setTimeout(function() { 16 $(document).on('blur', '#aftax_vat_field_checkout', handler); 17 }, 2000); 18 }); 19 20}) 21 22 23 24 25jQuery( document ).ready(function($){ 26 if (jQuery('body').hasClass('woocommerce-checkout')) { 27 jQuery(document).on('change','select[name="billing_country"]',function(){ 28 showHideEUOnly(); 29 handleCheckboxDisplay(jQuery('select[name="billing_country"]').val(),jQuery('select[name="billing_state"]').val()); 30 31 }); 32 33 34 jQuery(document).on('change','select[name="billing_state"]',function(){ 35 handleCheckboxDisplay(jQuery('select[name="billing_country"]').val(),jQuery('select[name="billing_state"]').val()); 36 }) 37 38 39 jQuery('#billing_company').on('input', function() { 40 showHideEUOnly(); 41 }); 42 43 showHideEUOnly(); 44 handleCheckboxDisplay(jQuery('select[name="billing_country"]').val(),jQuery('select[name="billing_state"]').val()); 45 46 } 47}); 48 49 50function showHideEUOnly() { 51 var val = jQuery('select[name="billing_country"]').val(); 52 var eu = ['AT', 'BE', 'BG', 'HR', 'CY', 'CZ', 'DK', 'EE', 'FI', 'FR', 'DE', 'GR', 'HU', 'IE', 'IT', 'LV', 'LT', 'LU', 'MT', 'NL', 'PL', 'PT', 'RO', 'SK', 'ES', 'SE', 'GB']; 53 if (eu.indexOf(val) != -1 ) { 54 if(jQuery('.aftax_dependable') && jQuery('.aftax_dependable').length>0){ 55 if(jQuery('#billing_company').val() && jQuery('#billing_company').val().length >0){ 56 jQuery('.aftax-eu-only').show(); 57 } 58 else{ 59 jQuery('.aftax-eu-only').hide(); 60 jQuery('.aftax-eu-only input').val(""); 61 jQuery('body').trigger('update_checkout'); 62 } 63 } 64 else{ 65 jQuery('.aftax-eu-only').show(); 66 } 67 } 68 else { 69 jQuery('.aftax-eu-only').hide(); 70 jQuery('.aftax-eu-only input').val(""); 71 jQuery('body').trigger('update_checkout'); 72 73 } 74} 75 76 77function handleCheckboxDisplay(billing_country,billing_state){ 78 79 jQuery.ajax({ 80 type: 'POST', 81 url: aftax_php_var.admin_url, 82 dataType: 'json', 83 data: { 84 action: 'aftax_handle_tax_exemption_on_billing_address', 85 nonce:aftax_php_var.nonce, 86 aftax_billing_country: billing_country, 87 aftax_billing_state : billing_state, 88 89 }, 90 success: function(response) { 91 92 if (response.data.status == 'pass') { 93 jQuery('#tax_exemption_checkbox_div').show(); 94 if(response.data.exemption_method == 'auto'){ 95 if(response.data.refresh){ 96 afUpOrder(); 97 } 98 } 99 } 100 else{ 101 jQuery('#tax_exemption_checkbox_div').hide(); 102 103 if(response.data.refresh){ 104 afUpOrder(); 105 } 106 107 if(jQuery('#tax_exemption_checkbox').is(":checked")){ 108 jQuery('#tax_exemption_checkbox').prop('checked',false); 109 afUpOrder(); 110 } 111 } 112 }, 113 error: function(error) { 114 // Handle the error if needed 115 } 116 }); 117 118} 119 120 121
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.