jQuery( function($){ $("input[name='payment_method']").each(function () { if ($(this).val() == 'wc_gateway_bookeey') { $(this).trigger('click'); $(this).attr('checked'); }else { $(this).attr('checked', false); } }); $('body').on('change', 'input[name="payment_method"]', function () { if ($(this).val() !== 'wc_gateway_bookeey') { $('input[type=radio][name=paymentoptions]').each(function () { $(this).attr('checked', false); }); } }); }); function updateCheckout(paymentOption){ jQuery(function ($) { $("input[name='payment_method']").each(function () { if ($(this).val() == 'wc_gateway_bookeey') { $(this).trigger('click'); $(this).attr('checked'); }else{ $(this).attr('checked',false); } }); var p = paymentOption; $('#paymentoption_' + paymentOption).attr('disabled', true); $.ajax({ type: 'POST', url: wc_checkout_params.ajax_url, data: { 'action': 'woo_get_ajax_data', 'radio': p, }, success: function (result) { $('body').trigger('update_checkout'); $('#paymentoption_' + paymentOption).attr('disabled', false); } }); }); }