I’m pretty excited about this tutorial because I wanted to write it for a long time and now I finally had few minutes to do so.
With it you will learn how to automatically create a vendor in your shop using WooCommerce Product Vendors.
Update 26th February 2016: From Product Vendors 2.0 the vendor’s registration form is included in the plugin. Please find more here.
Note: The code in this tutorial will automatically create a vendor for any user who registers to your site. If you only need some accounts to be vendors, it’s not for you.
How to automatically create a vendor?
You need to add a bit of code in your site. Open your functions.php file located in wp-content/themes/your-theme-name/ and add this code at the end of the file:
This is already working now. All the accounts registered will create a vendor with 50% commissions. The commissions will be sent to the email registered to the account which is supposed to be the same used on the vendor PayPal account.
To avoid issues, it would be a good idea to add a notice in the registration form warning users to use their PayPal account email to register. To do so, add this code after the one previously added:
The form should look like this:
That’s all folks! You are ready to accept vendors on your site automatically!