Created
January 21, 2018 01:04
-
-
Save albionselimaj/d9a94497bb9d477b0b586a01ef2293f3 to your computer and use it in GitHub Desktop.
Add Terms & Condtions in WooCommerce registration form
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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