Few days ago one of my client requested me to implement a promo code field ( screenshot attached) in payment form (which i helped him created using contact form 7) to show a discounted price. I helped him implemented this and sharing you the code.
Procedure
- Here is the Contact form 7 field to use
[text couponcode placeholder "Promo Code"]
<span class="discountedPrice"> </span>
2. Here is the jQuery code ( Use Simple Custom CSS and JS plugins for this)
jQuery(document).ready(function(){
jQuery('input[name="couponcode"]').on('input keyup', function(e){
let couponcode= jQuery( 'input[name="couponcode"]' ).val().trim();
if(couponcode=="ab123"){
jQuery('span.discountedPrice').html("$100");
}
if(couponcode=="BC9287"){
jQuery('span.discountedPrice').html("$499");
}
});
});
Feel free to do ask comments in the comments box if you face any issue or contact me in skype om2000_cuet.