I’ve currently got a checkbox added to the checkout page for accepting the terms and conditions. I want to move this to the cart page, so they have to tick this to get through to the checkout page.

Here’s my functions, is this possible?

add_action('woocommerce_review_order_before_submit', 'add_checkout_tickbox', 9);

function add_checkout_tickbox() { ?>

<p class="form-row terms">
<input type="checkbox" class="input-checkbox" name="terms" id="terms" />
<label for="terms" class="checkbox">I accept I've seen the below terms</label>
<a href="/terms" class="btn-primary">See the terms</a>
</p>

<?php }

// Show notice if customer does not tick

add_action('woocommerce_checkout_process', 'not_approved');

function not_approved() {
    if ( ! $_POST['terms'] )
        wc_add_notice( __( 'Please acknowledge the terms and conditions' ), 'error' );
}

Thanks!

Read more here: Moving terms & conditions checkbox to cart page – Woocommerce


Solution:

If you know the solution of this issue, please leave us a reply in Comment section, to update the question.


Wordpress related questions and answers: