1jQuery(document).ready(function ($) { 2 if (jQuery('.woocommerce-checkout').length > 0) { 3 jQuery('.woocommerce-checkout').on('change', 'input[type=radio][name=payment_method]', function () { 4 if (jQuery(this).val() === 'wc_wholesale_payments') { 5 jQuery('.payment_method_wc_wholesale_payments input[type=radio][name=wpay_plan]:first').prop('checked', true); 6 } 7 }); 8 } 9}); 10 11jQuery(document).ajaxComplete(function (event, jqxhr, settings) { 12 const objData = getQueryParams(settings.data); 13 if (typeof objData?.payment_method !== "undefined" && objData?.payment_method == "wc_wholesale_payments") { 14 jQuery('.payment_method_wc_wholesale_payments input[type=radio][name=wpay_plan]:first').prop('checked', true); 15 } 16}); 17 18function getQueryParams(data) { 19 var params = {}; 20 var queryString = data; 21 var regex = /([^&=]+)=([^&]*)/g; 22 var m; 23 24 while (m = regex.exec(queryString)) { 25 params[decodeURIComponent(m[1])] = decodeURIComponent(m[2]); 26 } 27 28 return params; 29}
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.