How do I add custom fields to the registration form on my store if I am using Product Vendors?

As the internet evolves, so does the information you need from customers when they register with your store. It’s likely that a default registration form will cover everything you want to gather when some signs up. For example, having social media usernames can help you keep in touch, but those fields are not automatically part of the default form.

It’s also important that you be able to add the same information if you manually create a user within the dashboard itself. Adding and modifying a bit of code in your theme’s function.php file will allow you to do both.

View the code on Gist.

Let’s break down this code a bit.

Lines 1 to 50, adds the two new fields to the taxonomy in the Product Vendors form. This allows you to specify their Facebook or Twitter URLs as to manually create or edit a vendor in the WP-Admin.

Lines 51 to 76, validates and saves the fields in the database.

Lines 78 to 91, adds the same fields to the registration form. You can show this on a page by using the shortcode:


The fields will appear after the Vendor Description fields. These are shown at the end of the form right before the Submit button.

Lastly, lines 93 to 98 saved the fields in the vendor taxonomy.

Of course this is a simple example with two text fields. You could easily add any kind of fields you want, even more than 2.

This is just a simple example with two text fields, as you can imagine you can add any kind of fields, and as many as you want.



How to KVM, QEMU start or stop virtual machine from command line (CLI)

KVM or Kernel Based Virtual Machine is a popular virtualization technology. It allows you to run virtual guest machines over a host machine. To start...

How to Docker backup Saving and restoring your volumes

Running a Docker volume backup First, we spin up a temporary container, and we mount the backup folder and the target Docker volume to this container....

How to Start and Enable Firewalld on CentOS 7

In this article, we discuss how to start and enable firewalld. It is highly recommended that you have a firewall protecting your server.Pre-Flight CheckThese...