I have added a checkbox in Woocommerce checkout with this
add_action( 'woocommerce_before_checkout_form', 'add_checkout_checkbox', 10 );
function bt_add_checkout_checkbox() {
$maximum = 200;
if ( WC()->cart->total > $maximum ) {
woocommerce_form_field( 'checkout-checkbox', array(
'type' => 'checkbox',
'class' => array('form-row mycheckbox'),
'label_class' => array('woocommerce-form__label woocommerce-form__label-for-checkbox checkbox'),
'input_class' => array('woocommerce-form__input woocommerce-form__input-checkbox input-checkbox'),
'required' => false,
'label' => 'Lorem ipsum',
));
}}
I need to disable the payment method PayPal if this checkbox is NOT checked. If it is checked, PayPal should be enabled. How do I need to adapt my code/add to it?