Discover with this tutorial how to hide mandatory fields in the Restrict Content Pro checkout, such as username and password confirmation.
In a previous tutorial you already saw how to remove Restrict Content Pro registration fields using CSS.
But there were still some mandatory fields like:
- User name
- Password confirmation
These fields cannot simply be hidden by CSS since, being mandatory, they would give you an error.
So in this tutorial you are going to see how to tell Restrict Content Pro that these fields are no longer required so you can hide them if you wish.
And here’s how:
Steps to remove mandatory fields from checkout in Restrict Content Pro
1. Remove user name and password confirmation fields
Add the following code at the end of functions.php or in your functionality plugin:
With the first snippet you get that the email is taken as the username and with the second one you eliminate the obligation to fill in the password confirmation field.
2. Hide the elements using CSS
Once you have indicated that the fields are not essential, you can hide them using CSS
To do this, add the following fragment to the end of the style.css file:
You got it.
3. Restrict styles to a specific registration page (optional)
If you use the above snippet, those registration elements will be hidden on all pages.
Is this what you want? Then you’ve got it.
But Restrict Content Pro allows you to create different registration pages, each associated with a particular subscription plan.
What if you only want your snippet to affect a specific signup page?
Then you need to make a small modification to the code.
First you need to get the page ID. You can do this by checking the URL when you edit the page or, if you want to make it easier for yourself, get it displayed directly in the WordPress admin with this tutorial.
Do you already have the ID? Then use this code snippet instead of the previous one:
In this case, the elements will only be hidden on the page with ID 18, but I invite you to modify the code with the one you are interested in.
At the request of a couple of subscribers I am preparing a tutorial showing the minimum possible version of the checkout. Stay tunned. 😉
It is proven that simplifying the subscription process improves the conversion rate.
Now you know how to remove required fields from the Restrict Content Pro signup form using code.
Any questions? Let me know in the comments.
And if you want to give me any suggestion for future tutorials, leave it in the contact form. Advantages of being a subscriber. 😉