| 1 |
<?php |
| 2 |
/** |
| 3 |
* Script for the checkout page. |
| 4 |
* |
| 5 |
* @package woocommerce-sequra |
| 6 |
*/ |
| 7 |
|
| 8 |
// phpcs:disable VariableAnalysis.CodeAnalysis.VariableAnalysis.UndefinedVariable |
| 9 |
?> |
| 10 |
<script> |
| 11 |
jQuery('.payment_method_sequra').show(); |
| 12 |
if (typeof window.sq_product_campaign === 'undefined') { |
| 13 |
window.sq_product_campaign = jQuery('input[name=sq_product_campaign]:first').val() |
| 14 |
} |
| 15 |
jQuery('input[value=' + sq_product_campaign + ']').prop('checked', true); |
| 16 |
jQuery('#payment_method_sequra').removeClass('input-radio').hide(); |
| 17 |
jQuery('label[for=payment_method_sequra').hide(); |
| 18 |
jQuery('div.payment_method_sequra').removeClass('payment_box'); |
| 19 |
jQuery('input[name=sq_product_campaign]').on('click', function () { |
| 20 |
jQuery('#payment_method_sequra').prop('checked', true).click(); |
| 21 |
window.sq_product_campaign = jQuery(this).val(); |
| 22 |
jQuery('input[name="payment_method"]').trigger('change'); |
| 23 |
}); |
| 24 |
jQuery('input.input-radio:not(.sq-input-radio)').on('click', function () { |
| 25 |
jQuery('input[name=sq_product_campaign]').prop('checked', false); |
| 26 |
}); |
| 27 |
jQuery(document.body).on('update_checkout', function (e) { |
| 28 |
jQuery('.payment_method_sequra').show(); |
| 29 |
jQuery('#payment_method_sequra').removeClass('input-radio').hide(); |
| 30 |
}); |
| 31 |
Sequra.onLoad(function () { Sequra.refreshComponents(); }); |
| 32 |
</script> |
| 33 |
|