Good morning everyone. I have a kind of strange request, in my woocommerce website I gave the option to take orders manually through phone calls, so there is a person that answer the calls and create orders for various customers.
This person use a custom made page to register orders, with the possibility to select an existing user or to create a new one, to add items to cart and to fill the shipping/billing address. In this page there is also the order review section with the checkbox of terms and conditions that everytime must be checked to complete the order.
Since this is waste of time in this case I'm looking for a way to keep this checkbox always checked.
Currently I'm using this code in my functions.php to show the terms and conditions as checked
function check_terms() {
if(is_page('custom-page')) {
return true;
}
add_filter( 'woocommerce_terms_is_checked', 'check_terms', 10 );
add_filter( 'woocommerce_terms_is_checked_default', 'check_terms', 10 );
This works until I add or remove a product in the cart, after that the checkbox is resetted to empty and I go back to the starting point. So I'm here to ask if any of you know a trick to keep this checkbox checked. I've already tried JS but without success since it's not fired after the update.
Thank you in advance and sorry for my english.
Have a nice day.
function patricks_wc_terms( $terms_is_checked ) {
return true;
}
add_filter( 'woocommerce_terms_is_checked', 'patricks_wc_terms', 10 );
add_filter( 'woocommerce_terms_is_checked_default', 'patricks_wc_terms', 10 );
Put this in your function.php file and try if any error then only replace function name