Skip to content

Instantly share code, notes, and snippets.

@albionselimaj
Created January 21, 2018 01:04
Show Gist options
  • Save albionselimaj/d9a94497bb9d477b0b586a01ef2293f3 to your computer and use it in GitHub Desktop.
Save albionselimaj/d9a94497bb9d477b0b586a01ef2293f3 to your computer and use it in GitHub Desktop.
Add Terms & Condtions in WooCommerce registration form
add_action( 'woocommerce_register_form', function() {
wc_get_template( 'checkout/terms.php' );
} );
add_action( 'woocommerce_process_registration_errors', function( $errors, $username, $password, $email ){
if ( empty( $_POST['terms'] ) ) {
throw new Exception( __( 'You must accept the terms and conditions in order to register.', 'text-domain' ) );
}
return $errors;
}, 10, 4 );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment