I have a JavaScript if
statement that does the following:
If a payment method called cardless is chosen, then the cardfee varable is set to be 1% of the total fee.
if (document.getElementById('payment_method').value == "Cardless") {
cardfee = ((thetotal * (1 + vatrate)) * 0.01);
}
document.getElementById('card_fee').value = cardfee;
formatPrice(document.getElementById('card_fee'));
The problem is that while the 1% of the total fee is fine, the payment method has a cap. Its 1% but a maximum of £2.
How would I make it do the calculation above, but then add another line that says if cardfee is greater than £2, set cardfee to £2?