Today, I will share with you a snippet that would allow you to make a WordPress user or WooCommerce customer to become a woocommerce vendor upon registration.
The first part of the code will make anyone that signs up to your website a Product vendor while the second part of the code will make only WooCommerce customers product vendors.
Just in case, product vendors are store owners on a website that supports vendors. So, if your store does not support vendors, you probably wont be needing this code.
Open up your theme’s functions.php and write this:
Turn users to product vendors
This code can do a lot but right now it does nothing. Why? Because it’s just a function that has not been called, like a gun loaded with bullets but the trigger hasn’t been pulled. Now, let’s pull the trigger by adding the following code below after the code above
Turn customers to product vendors
If you don’t want users or subscribers to become vendors automatically but would rather prefer only customers to become product vendors, please do not copy the code above. Copy the code below into your functions.php
Now, let’s pull the trigger by adding the following code below after the code above