Woocommerce checkbox by default in checkout
From experience, I found one flaw in the WooCommerce plugin and decided to fix it. In the standard version of WooCommerce, a checkbox has appeared where you can agree to the rules of the site, but there is no option for admin to make the checkbox selected by default.
It turned out that this functionality, like many things are just hidden in WooCommerce itself, and it is very easy to implement. To do this, you just need to add an additional small filter to the functions.php file. See code below:
1 2 3 4 5 |
add_filter( 'woocommerce_terms_is_checked_default', 'apply_default_check' ); function apply_default_check() { return 1; } |
Another way to add a checkbox to the rules of the store
So. create (if not) folder woocommerce in the theme folder in it the checkout folder and add the terms.php file there (it can be taken from the plugin folder of the same name )
now open the file and add checked=”checked” after name=”terms”.
Save and close, all, now on the checkout page there is a daw next to "I accept the terms ..." will stop automatically.
/*
- Basic web design course;
- Site layout;
- General course on CMS WordPress and continuation of the course on template development;
- Website development in PHP.