Quantcast
Channel: WordPress.org Forums » All Topics
Viewing all articles
Browse latest Browse all 59525

Deactivate Apply/google pay button if terms not accepted

$
0
0

Replies: 0

I faced issue with the plugin that people are able to pay without accepting terms and conditions.

I used the following code as work around for the issue

$(document).on( 'updated_checkout', function() {
check_terms();
}),$(document).on('change','[name="payment_method"],[name="terms"]',function(){
check_terms();
});
function check_terms(){

	if ($('[name="terms"]').is(':checked')) {
		$('.apple-pay-button').prop("disabled",false);
		$('.gpay-button').prop("disabled",false);
		$('.terms-alert').hide();
	}else{
		$('.apple-pay-button').prop("disabled",true);
		$('.gpay-button').prop("disabled",true);
		$('.terms-alert').show();
	}
}
button.gpay-button:disabled, button.gpay-button[disabled] {
    opacity: .5;
}

It would be great if payment with any method is disabled until terms are accepted in future updates


Viewing all articles
Browse latest Browse all 59525

Trending Articles