Monday’s post discussed creating a wholesale system with WooCommerce. While this article covered a bit on creating wholesale customers, it didn’t discuss how I typically manage those customers or add new wholesale buyers.

I’ll first describe in a bit more detail how to manually create wholesale customers, then how to accept wholesale customer applications and approve them.

Manually Creating WooCommerce Wholesale Customers

Many shops with wholesale buyers will add the wholesale customer manually, as a discussion via email or phone often takes place before adding the customer as a wholesale buyer.

Manually creating wholesale customers requires nothing but the User Role Editor plugin as described in our previous article. The new role is created, and then a shop admin can go to Users > Add New and manually create the wholesale customer, then assign the role of “wholesale customer”.

Manually create user

Manual create

This immediately grants the wholesale buyer the ability to purchase products in your WooCommerce store using any wholesale discounts or perks.

Automatically Create WooCommerce Wholesale Customers

However, what if you want to allow the open application of WooCommerce wholesale customers? Chances are you’d like to review these applications before approving the user and granting them the ability to take advantage of wholesale pricing.

You can do so with a few additional plugins and a small bit of custom code.

First, we’ll need to create our application, and use this to create a user for the prospective wholesale customer. The easiest way I’ve found to do this is to use Gravity Forms (developer license) and the User Registration Add-on. This will let me create the application form, and its submission will create a new user.

Create your Gravity Form under “Forms”, and include all fields that you’d like as part of your application, as well as fields for user data like username or password.

Create Gravity Form

Once your form has been created, we’ll need to tie user data to the right fields. You can do this under Forms > User Registration and create a new registration process. I’ve selected my form, and then mapped the form fields to the appropriate user data such as first name, username, password, and others.

Gravity Forms User Registration

Once you’ve saved both the form and the user registration tie-in, you can put it on a page on your site. Prospective wholesale customers can apply via this form, and you can even automatically set the role to “wholesale customer” when the new user account is created.

There’s one problem with this setup: the user is automatically created when the form is submitted, which doesn’t give you a chance to review the form before allowing the new user to access wholesale pricing. We’ll need one more step to fix this.

Approving WooCommerce Wholesale Customers

The New User Approve plugin will ensure that we can hold all new user applications for approval. This plugin sets all new user accounts on your site to “pending” until you manually approve a user (or approve them in bulk).

When this plugin is active, all new applications via your Gravity Form will create a “pending” user that you can approve when you’ve reviewed the form.

Approve WooCommerce wholesale customer

Approve Wholesale customer

You can read the application, then approve the account for the correct username.

Of course, it can’t be this easy. There’s one very important issue here: if you allow customer registration on your site at checkout or on the my account page, these accounts will also be held for approval. This will hang your checkout process and break it if a user registers an account at checkout, and the user never sees the “Thank You” page.

We obviously don’t want this to happen, and we want to automatically approve all new customer accounts. Fortunately, the New User Approve plugin contains some helpful methods to check the user status and approve the user, which we’ll do when WooCommerce creates the account.

This code snippet will auto-approve customer accounts, and can be placed in a custom plugin or functions.php file:

Now customer accounts will be treated differently than new wholesale customer applications. While the wholesale customer must wait for approval before they can log in or use the account, regular customers will be approved automatically when they’re created.

Auto Approve WooCommerce wholesale customer

Auto-approved customer

This method will ensure that user approval gets out of the way of your WooCommerce store’s customer accounts, but that your WooCommerce wholesale customers must have an approved application before they have access to your store.

Pros and Cons

Manually creating wholesale customers gives you the most control over your wholesaler program, and requires no additional plugins or integrations to create your wholesale customers.

However, this can become tedious if you accept open applications for your wholesale program, as you’ll need to gather emails and enter all user details to get a wholesale customer set up. Automating account creation via a form can simplify this process and ensure that you only have to review / approve a wholesale customer, but requires some additional cost and setup.

To create wholesale applications and approval, you’ll need to add these plugins to your WooCommerce wholesale setup:


Cover Photo Credit: Mike Mozart (CC BY 2.0 license)
Note: This post may contain affiliate links, which means we get a commission from the plugin, theme, or service provider if you choose to purchase. Regardless of this, we are committed to providing high quality, unbiased resources. Have more questions? See our affiliate policy. You can use the plain links below if you prefer that we not receive a referral commission:
Articles you may also like:

Posted by Beka Rice

Beka Rice manages the direction of Sell with WP content and writes or edits most of our articles to share her interests in eCommerce. Or she just writes as an excuse to spend more time jamming out to anything from The Clash to Lady Gaga. Who knows.

9 Comments

  1. I just want to say THANK YOU for posting this and the previous article! This helped me so much, as I was needing to implement this structure, and I couldn’t find anywhere online that helped me half as much as this. THANK YOU! THANK YOU! THANK YOU!

    Also, just wanted to point out 3 things for others that are looking at this.

    In the previous article (part 1) a girl commented that she used the “Price by user Role” plugin – this helped tremendously, and was free.
    I searched online and there are plenty of $50 off coupons for Gravity forms. $199 is a bit steep, when I was hoping this would work, but i followed the instructions in this article and can confirm that it does. I had never used Gravity Forms before, but it was very simple and I’ll be using them on all of my sites.
    My application only differed from the authors in the fact that I do not need to approve the wholesale accounts. But what I did need to happen was for the newly created account to be automatically logged in. This took some snooping, but on the Gravity forms forums, if you search for “atuo-loggin” you will find an easy solution.

    I’m not generally a comment’er, but this helped me so much I just really wanted to show appreciation to the author, and maybe provide a little help to other readers.

    Thanks again!

  2. can u help me to know where i have to place code snippet to auto-approve customer accounts?

    I tried to place it in new user approve.php file but it didn’t work..

    ANY HELP regarding this issue is greatly appreciated!!!

    1. I think it goes in your theme’s functions.php 🙂

  3. Thanks a lot! Now it worked after placing it correctly.But,one issue is still there.After auto approval customers are also receiving email your account has been approved…

    I think we have to filter it by role incase it is a customer then approval mail should not be sent.

  4. Hello

    Ok so setup and tested and whilst the Gravity Forms pending signup works great, the customer sign up sadly does not, I get the following error when trying to register

    Fatal error: Call to undefined function pw_new_user_approve() in… functions.php on line 29

    Line 29 is the following

    if ( ‘pending’ == pw_new_user_approve()->get_user_status( $customer_id ) && in_array( ‘customer’, $roles ) ) {…

    Any direction please?

    1. Resolved, another developer has disabled the new user approval plugin.

  5. Thank you for this tutorial! It’s been VERY helpful with my recent project.

  6. Hi Beka,

    I found myself reading through this because of a need in my sandwich shop to allow multiple users from the same company to access the account. The idea being that if one person is away then another person can log in to the site with their credentials and see the purchase history of other registered users from the same company. This way they can re-order and, if necessary edit a previous order rather than having to start a new order all over again.

    So, I don’t really need wholesale prices but I do need multiple users from the same company being able to access the one account.

    Does your wholesale customer facility allow for this?

    Cheers
    Russell

    1. I’m afraid this would be tied to a single WP user, there’s no way to have “company” accounts or sub accounts with WooCommerce. You could vote for this on their roadmap here.

It's been over 2 years since this post was published, so comments have been closed. Thanks for reading!