My client would like to have two types payment methods one is COD another is PayPal. When the customer clicks the delivery button this will disable COD option and if the customer clicks the takeaway button the PayPal option will be disabled in the checkout page in Woocommerce. Please help me fix this? Both buttons will be set top of the check out page.
Asked
Active
Viewed 322 times
0
-
Please consider the answers given here https://stackoverflow.com/questions/46121480/how-do-i-make-a-specific-payment-gateway-to-be-free-shipping-on-woocommerce and adapt to your scenario – Brad Holmes May 27 '22 at 18:27
-
@BradHolmes already fix it – mikebension Jun 01 '22 at 07:02
1 Answers
0
By the type of delivery/takeout button click, adding/removing disabled attribute from payment radio option can help like this way.
$("#btnDelivery").on('click', function(){
$('#payment_method_cod').attr("disabled", "true");
$('#payment_method_paypal').removeAttr("disabled");
});
$("#btnTakeout").on('click', function(){
$('#payment_method_paypal').attr("disabled", "true");
$('#payment_method_cod').removeAttr("disabled");
});

Biplob Ahmed
- 106
- 4