Here’s a snippet regarding the “My Account” registration form and, once again, GDPR. If you get any website traffic from EU, you will need users to give you Privacy Policy consent – including when they register a new account on your WooCommerce website.
So, how do we display a checkbox on the My Account page, at the bottom of the registration form?

PHP Snippet: Add Privacy Policy Checkbox @ WooCommerce My Account Registration Form
/** * @snippet Add Privacy Policy Checkbox @ WooCommerce My Account Registration Form * @how-to businessbloomer.com/woocommerce-customization * @sourcecode https://businessbloomer.com/?p=74128 * @author Rodolfo Melogli, Business Bloomer * @testedwith WooCommerce 3.5.1 * @community https://businessbloomer.com/club/ */ add_action( 'woocommerce_register_form', 'bbloomer_add_registration_privacy_policy', 11 ); function bbloomer_add_registration_privacy_policy() { woocommerce_form_field( 'privacy_policy_reg', array( 'type' => 'checkbox', 'class' => array('form-row privacy'), 'label_class' => array('woocommerce-form__label woocommerce-form__label-for-checkbox checkbox'), 'input_class' => array('woocommerce-form__input woocommerce-form__input-checkbox input-checkbox'), 'required' => true, 'label' => 'I\'ve read and accept the <a href="/privacy-policy">Privacy Policy</a>', )); } // Show error if user does not tick add_filter( 'woocommerce_registration_errors', 'bbloomer_validate_privacy_registration', 10, 3 ); function bbloomer_validate_privacy_registration( $errors, $username, $email ) { if ( ! is_checkout() ) { if ( ! (int) isset( $_POST['privacy_policy_reg'] ) ) { $errors->add( 'privacy_policy_reg_error', __( 'Privacy Policy consent is required!', 'woocommerce' ) ); } } return $errors; }
Hello,
Any tip how to fix it for block editor?
Not possible, sorry.
Thank you Rodolfo for information 😉
There is a way to save this user action by “database list”? To tracking user and acceptance of the conditions, like into contact form for GPDR.
Thank you,
Vincenzo
Ciao Vincenzo, thanks so much for your comment! Yes, this is definitely possible, but I’m afraid it’s custom work. If you’d like to get a quote, feel free to contact me here. Thanks a lot for your understanding!
I found help on Stackoverflow how to add the HTML5 require attribute to the tag. You need to add this:
Nice, but does it actually validate and stop the registration?
Hello. Does it work with code snippets plugin? Because I just tried it like that and the check box or text don’t show up on the checkout page. Thank you.
Yes – tried with a different theme also?
This one is great!
Great!
Hi Rodolfo!
I need to add a checkbox below or beside the create account checkbox in the finish buy page of woocommerce.
it has to be: “I accept the register privacy policy” checkbox, neccessary clickable for craete account, you know.
Important: this checkbox has to be different to the two checkboxes below the “finish buy button” ( terms and conditions and privacy policy)
Thank you very much.
Hola Jorge, thanks so much for your comment! Yes, this is definitely possible, but I’m afraid it’s custom work. If you’d like to get a quote, feel free to contact me here. Thanks a lot for your understanding!
Hi Rodolfo,
excellent post like everyone in your blog.
Is it possible to save consent in the profile of the user who registered on the website?
Thank you! Yes, use something similar to https://businessbloomer.com/woocommerce-save-terms-conditions-user-acceptance-checkout/
Hello Rodolfo,
I installed the hook on functions.php, but just text is showing. The checkbox don’t show, can you help?
Thanks in advance
Did you use the exact snippet?
Hello Rodolfo,
Yes! I’m using this exact snippet
Disable all plugins but Woo and switch theme, test again 🙂
Hey1
First of all thank you for this code. I’ve been using it for a long time but now is giving me some little problems.
When I register an user trough the register form and then you click the “user icon” to login or register in the top-right of the website) when the user doesn’t check the checkbox it just redirects the user to the home page but is not displaying any error… so sometimes can be confusing for some users to understand that the have not registered.
Hi there, thanks for your comment! If you temporarily disable all plugins but Woo and switch theme, does the snippet work?
Hi, thank you for this example.
There is some bug in woocommerce I think, that prevents the woocom native privacy checkbox from displaying in checkout page in some scenarios. So I tried to use your code, only hooking on to woocommerce_after_checkout_billing_form instead of woocommerce_register_form. So the checkbox displays, but I still get the error msg
‘Please acknowledge the Privacy Policy’
What should be the name of the checkbox input to make woocommerce reckognize it?
Hello Hal, try with https://businessbloomer.com/woocommerce-additional-acceptance-checkbox-checkout/
Its not working for me my changes are getting reverted with php. And if i try style.css in my child theme it shows 69 errors should i try style.css?
Hey Khalid, what error are you getting? This goes in functions.php
It works perfectly! Could you add the possibility to save the check on the database?
Hey Roberto, thanks so much for your comment! Yes, this is possible – but unfortunately this is custom work and I cannot provide a complementary solution here via the blog comments. Thanks a lot for your understanding! ~R
Hi Rodolfo.
Can you help me to add a second checkbox that links another additional Privacy Page?
What is the best way please? I see that duplicate is not the best way and my site go to error 500.
Thanks.
Mirta
Hi Mirta, thanks so much for your comment! Yes, this is possible – but unfortunately this is custom work and I cannot provide a complementary solution here via the blog comments. If you’d like to get a quote, feel free to contact me here. Thanks a lot for your understanding! ~R
Hi! Great stuff, thanks! It would be awesome if you could show how to add an optional checkbox to registration page, and how to display the status of it on user profile pages (backend/frontend).
Hey Radoslaw, thanks for your comment! Here you go: https://businessbloomer.com/woocommerce-add-privacy-policy-consent-my-account-registration
Hello,
great snippet and it works great on the My Account page.
I can see though that this causes an issue when a user will try to register to the site via the checkout page ,
as the checkbox to opt in for the Privacy Policy is not appearing there and “Privacy Policy consent is required!” is showing – thus preventing the user from placing an order!
Any workarounds here?
Would it better if just added a text as done here? > https://businessbloomer.com/woocommerce-add-content-under-place-order-button-checkout/
Thank you!
___
WP 4.9.5 – WC 3.2.6
Hey Bill, thanks for that, good point 🙂 I added:
… to both parts of the snippet. Can you test again please?
Always very useful !
Thank you 🙂
Could we make it so they have to tick that box each time they log in too? That way it’ll capture all the current members too.
Hello Sam, thanks so much for your comment! Yes, this is possible – but unfortunately this is custom work and I cannot provide a complementary solution here via the blog comments. Thanks a lot for your understanding! ~R
Hi Rodolfo
I tried this and it seems to be working now! However the codes I copied & pasted disappeared from the child theme function.php, is this normal?
Cool Sean 🙂 No, it’s not normal… what happened?
Really nice idea! Good job!
Thank you so much Nicola! Ciao 🙂
Works perfectly Rodolfo. Thank you. Really great website resource btw. Just discovered you and I like what I read.
Brilliant 🙂
Many thanks for this. It is working great on some of my pages BUT on others it shows correctly but no errors are shown if I don’t tick the checkbox or even if I do not enter an email. What could this be??
Ok I figured it out. It was the Advanced noCaptcha & invisible Captcha Plugin messing about.
Just a couple of questions:
1. If I wanted to add a second checkbox (I am over 13 years of age, etccc) can I just duplicate de module
2. Is the consent recorded anywhere?
Again, many thanks.
Excellent 🙂 Yes, you can add as many checkboxes as you like. To save them, take a look at https://businessbloomer.com/woocommerce-save-terms-conditions-user-acceptance-checkout/
Hi Rodolfo,
thanks for the new amazing snippet. I only would like to know if there’s a way to output the “I’ve read and accept the Privacy Policy” label also in other language. I have a multilanguage website with polylang plugin.
Thanks again for your availability.
Hey Fabrizio, thanks for your comment! In order to make a string translatable you have to wrap it in a __() function: https://codex.wordpress.org/I18n_for_WordPress_Developers#Translatable_strings – hope this helps 🙂
works perfectly!!!!! thank you!!!!! another master piece from you!!!! grazie!!!
Excellent 🙂