Jump to content

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.

Link to comment
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?).

Link to comment
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?

Link to comment
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

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...

Important Information

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