How to make checkbox checked by default? In Woocommerce checkout

checkbox, checkout, getresponse, woocommerce, wordpress

Solution

You need to add the following code to your functions.php

add_filter( 'woocommerce_create_account_default_checked', '__return_true' );

Problem

Have a wordpress site with woocommerce I installed the Getresponse Woocommerce Integration plugin and really need the checkbox at checkout to be TICKED by default (they tick a box "sign up to our newsletter" to join our email list) Been trying everything, would really appreciate help on how to do this? I suspect I should change something in line 394 of getresponse_integration.php ``` <input class="input-checkbox" value="1" id="checkout_checkbox" type="checkbox" name="checkout_checkbox"> ``` Have tried inserting things like "checked" like this: ``` <input class="input-checkbox" value="1" id="checkout_checkbox" type="checkbox" name="checkout_checkbox" checked> ``` This makes the box appear checked at checkout but it the emails DO NOT get passed to the list, so I dont receive any welcome email and are not subscribed. Funnily enough if I manually untick the box and retick then it works Have tried other things like class=selected and no luck?? Would really appreciate some help please? P.S. Have tried getresponse support and they are no help at all http://wordpress.org/plugins/getresponse-integration/

Original source