Hi there,
I am developing a site where the client wants the users to be able to “Gift Aid” their donations by checking a box on the checkout page. I found a plugin that adds the checkbox but the client wants it to be checked by default. I can’t seem to manipulate the code to do this.
Here is the code that creates the checkbox:
// Echo the checkbox field with label text.
woocommerce_form_field( 'gift_aid_reclaimed', array(
'type' => 'checkbox',
'class' => array( 'input-checkbox' ),
'label' => esc_html( $gift_aid_label ),
'required' => false,
), $checkout->get_value( 'gift_aid_reclaimed' ) );
I have tried added 'checked' => true,
after the “required” line but that has no effect.
Does anyone know how I can change the behaviour of the checkbox to make it checked by default?