0
votes

Is there a way to do this in WooCommerce checkout page.

All I want is a custom textarea field in the WooCommerce checkout page and when I start to write something in the textarea then automatically the payment gateway will change from paypal to cheque

enter image description here

1
Can you please elaborate more on what exactly you want in woocommerce checkout page? I may be wrong but, apparently, it seems to me that you are looking for a dependency injection kind of solution where the dependency lies in the text in the textarea. - Shikhar Maheshwari
currently when in checkout page, there is two payment, paypal and cheque... I have created an extra textarea in the checkout page and when they write something there then the payment will change to only cheque and remove paypal - Francis Alvin Tan

1 Answers

0
votes

okay, assuming #txt1, your textarea's id

in your functions.php

function bh_change_gateway() {?>
<script>
jQuery('#txt1').keyup(function(){
jQuery( '.payment_methods input.input-radio' ).removeProp('checked');
jQuery( '#your_payment_gateway_id').attr("checked", "checked");
})
</script>


<?}

add_action('woocommerce_review_order_before_submit','bh_change_gateway' );

thanks!