Hello I need some help making the checkbox I made checked automatically. I’m using this code to insert the checkbox in the checkout on Woocommerce.
What code can I use to make the checkbox checked?
// Our hooked in function - $fields is passed via the filter!
function custom_override_checkout_fields( $fields ) {
$fields['billing']['mc4wp-try-subscribe'] = array(
'label' => __('Newsletter', 'woocommerce'),
'type'=> 'checkbox',
'required' => false,
'checked' => true,
'value' => '1',
'class' => array('form-row-wide'),
);
return $fields;
}
Add this to your array:
Try with this:
I hope help you 😉