oont-contents/plugins/bookeey_plugin/js/bookeey.js
2025-02-08 15:10:23 +01:00

45 lines
No EOL
1.4 KiB
JavaScript

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);
}
});
});
}