In this article, we will describe how to change the interest rate when the user changes the number of months
It will require php customization. Please add code below to your Child Theme functions.php file. You can read more about child themes here.
add_action('wp_footer', function () {
?>
<script>
jQuery(window).on('load', function () {
jQuery('#vehica-loan-calculator__months').on('change paste keyup', function () {
var value = parseInt(jQuery(this).val());
if (value > 48) {
AutoNumeric.set('#vehica-loan-calculator__rate', '7');
} else if (value > 36) {
AutoNumeric.set('#vehica-loan-calculator__rate', '6');
} else {
AutoNumeric.set('#vehica-loan-calculator__rate', '5');
}
window.VehicaEventBus.$emit('loanCalculator/calculate');
})
})
</script>
<?php
});