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.
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”.
This immediately grants the wholesale buyer the ability to purchase products in your WooCommerce store using any wholesale discounts or perks.
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.
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.
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.
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.
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.
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.
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:
Your WooCommerce store can drive additional revenue by improving your email marketing. Try Jilt for free to increase sales with abandoned cart recovery emails, post-purchase follow-ups, and more!