Jump to content
LynxMukka

Making Optional Fields Compulsory During Ordering

Recommended Posts

Hi all - looking for some help if this is currently possible in WHMCS..

If we were to have a set of optional fields (like billing address) during user registration,  can we get these so that they're compulsory during the ordering of a product? Or in other words, we have some custom fields during registration, but WHMCS will prevent the user from creating a new order until they've provided  certain additional fields.

Like other sites, we want to provide the ability for customers to register (without bombarding them with input fields), understand how our portal works, and then make an order when they're ready.

Hope this makes sense.

Share this post


Link to post
Share on other sites
13 hours ago, LynxMukka said:

Hope this makes sense.

so in other words, some fields would be optional/removed on register.php, but required at checkout ?

not from admin settings, but it could be achieved with hooks, possibly even template edits - but often it's just simpler to disable registration and leave it until ordering before the need to collect client info (unless there is some specific need on your site for them to register first before ordering?).

Share this post


Link to post
Share on other sites
19 hours ago, brian! said:

so in other words, some fields would be optional/removed on register.php, but required at checkout ?

not from admin settings, but it could be achieved with hooks, possibly even template edits - but often it's just simpler to disable registration and leave it until ordering before the need to collect client info (unless there is some specific need on your site for them to register first before ordering?).

Thanks for the guidance.

If we were to look at doing this without disabling registration, how might you go about it with hooks?

Share this post


Link to post
Share on other sites
On 03/12/2019 at 09:48, LynxMukka said:

If we were to look at doing this without disabling registration, how might you go about it with hooks?

what I would do first is make these fields optional in setup -> general settings -> other -> optional client profile fields... that will make them optional on both the registration and checkout pages...

then I would use a hook to make these specific fields required at checkout.. an example of which I have posted previously in the thread below...

in that example, the companyname and taxid fields are now required at checkout - but would still be optional during registration.

one thing that I seem to have forgotten to mention in that solution is the requirement to create Language Overrides for the error messages (in each language used on your site) - or you could hardocde the error in a specific language in the hook.

$_LANG['clientareaerrorcompanyname'] = "You did not enter a company name";

M1OP14p.png

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

  • Recently Browsing   0 members

    No registered users viewing this page.

×

Important Information

By using this site, you agree to our Terms of Use & Guidelines and understand your posts will initially be pre-moderated