Skip to content

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

[gist id=81cef2ab5fc766043921445daaa9d405]

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

[gist id=14f38d5ae7823201e71fa46d009d9391]

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

[gist id=895516b9957123ea7987a68ffd92aea9]

Now, let’s pull the trigger by adding the following code below after the code above

[gist id=94f46898cc1321f87dc458d2aefde42f]

 

One response to “Create WooCommerce vendor on user registration

  1. How can we disable the default fron New User Approve plugin? or how we can apply woocommerce template to this one?

    Thanks

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.