In this article, we will describe how to change the interest rate when the user changes the number of months

2021-02-09_08h05_48.gif

 

It will require php customization. Please add code below to your Child Theme functions.php file. You can read more about child themes here – https://tangiblewp.freshdesk.com/support/solutions/articles/101000373821-how-to-use-child-theme-how-to-change-files-php-css-js-and-keep-theme-future-update-compatibili

 

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