How to set the default checkbox? In Woocommerce checkout

Do you have a wordpress site with woocommerce

I installed the Getresponse Woocommerce Integration plugin and really need a checkmark when I check out by default TICKED (they put a "Subscribe to our newsletter" checkbox to join our email list)

Tried everything, would really appreciate help on how to do this?

I suspect I should change something on line 394 getresponse_integration.php

<input class="input-checkbox" value="1" id="checkout_checkbox" type="checkbox" name="checkout_checkbox">

Tried to insert things like "checked" like this:

<input class="input-checkbox" value="1" id="checkout_checkbox" type="checkbox" name="checkout_checkbox" checked>

This means that the checkbox is displayed on the checkbox, but it does not appear on the list, so I do not receive a welcome letter and do not subscribe. Funny enough, if I manually disconnect the box and return, then it works

, class= selected ?

?

P.S. getresponse,

http://wordpress.org/plugins/getresponse-integration/

+3
3

jQuery :

<script>
$(document).ready(function () {
    $('#checkout_checkbox').attr('checked', 'checked');
});
</script>

, !

+4

. php

add_filter( 'woocommerce_create_account_default_checked', '__return_true' );
+4

There are hooks for this. All you have to do is add this to your theme functions.php file. The advantage is that you won’t lose the change when updating woocommerce files.

add_filter( 'woocommerce_terms_is_checked_default', 'apply_default_check' );
function apply_default_check() 
{
    return 1;
}
+1
source

All Articles