27 lines
760 B
JavaScript
27 lines
760 B
JavaScript
jQuery('document').ready(function () {
|
|
'use strict';
|
|
|
|
var shippingMethodsTriggers = [
|
|
'pk_inpost_paczkomat',
|
|
'pk_paczka_w_ruchu'
|
|
];
|
|
|
|
jQuery('form.woocommerce-checkout').on('change', 'input[name="payment_method"]', function () {
|
|
var $shippingMethod = jQuery('input.shipping_method');
|
|
var value;
|
|
if ($shippingMethod.length > 1) {
|
|
value = $shippingMethod.filter(':checked').val();
|
|
} else {
|
|
value = $shippingMethod.val();
|
|
}
|
|
|
|
if (value.indexOf(':')) {
|
|
value = value.substring(0, value.indexOf(':'));
|
|
}
|
|
|
|
if (shippingMethodsTriggers.indexOf(value) !== -1) {
|
|
jQuery('body').trigger('update_checkout');
|
|
}
|
|
});
|
|
});
|