How to Save Terms & Conditions Acceptance at Checkout page?

Your customer needs to approve terms & conditions while placing an order. One has to tick the terms & conditions checkout box before proceeding further. This is how WooCommerce store admin can verify whether terms are accepted or not. In this article, you will learn how to save terms & conditions acceptance at checkout page. 

You can save such acceptance in your database. Later, you can print it on the order admin and customer invoice. Furthermore, you will find a simple PHP snippet that you can copy & paste in your child theme. You can save it in functions.php file. It is for both saving & printing acceptance on the single order admin page. This is how you get proof that one agrees to terms. Enjoy reading!

Image showing how to save terms & conditions acceptance at checkout and WooCommerce store admin

PHP Snippet: WooCommerce Save Terms & Conditions Acceptance at Checkout page

// 1. Save T&C as Order Meta
add_action( 'woocommerce_checkout_update_order_meta', 'phpsof_save_terms_conditions_acceptance' );
function phpsof_save_terms_conditions_acceptance( $order_id ) {
if ( $_POST['terms'] ) update_post_meta( $order_id, 'terms', esc_attr( $_POST['terms'] ) );
// 2. Display T&C @ Single Order Page
add_action( 'woocommerce_admin_order_data_after_billing_address', 'phpsof_display_terms_conditions_acceptance' );
function phpsof_display_terms_conditions_acceptance( $order ) {
if ( get_post_meta( $order->get_id(), 'terms', true ) == 'on' ) {
echo '<p><strong>Terms & Conditions: </strong>accepted</p>';
} else echo '<p><strong>Terms & Conditions: </strong>N/A</p>';

Where do you add this snippet?

So, this is how you can save terms & conditions acceptance at checkout page. Also, it is easier to activate this function with this code. So, to apply this code, just add this PHP snippet at your child theme function.php file’s bottom. It should be placed before “?>”, if you have it there. Apart from this, CSS goes in your child theme style.css file. Make sure that you are editing these files in a right manner for best results.

Is this snippet still valid?

So, this is how you can learn about save terms & conditions acceptance in WooCommerce. I have applied this code on the Storefront theme and WordPress friendly hosting PHP 7.3. Let me know if everything works as expected when you code. Share it further if you find this snippet useful for you and it had saved your time. 

Also Read, How to Hide Shipping Rates if Free Shipping Available in WooCommerce?

How to Send Checkout Details to Email Recipients in WooCommerce?

Important links: WooCommerce –