How To Adjust Visibility Of Wholesale Products

How To Adjust Visibility Of Wholesale Products

Controlling who can see which products in your store is really important once you start selling products wholesale.
This guide will take you through the options for controlling product visibility within your store.
There are currently four main options for controlling product visibility across the store within the Wholesale Suite plugins (primarily speaking about WooCommerce Wholesale Prices Premium and WooCommerce Wholesale Order Form):

The 「Only Show Wholesale Products To Wholesale Users」 global setting
The 「Restrict To Wholesale Roles」 visibility options on products themselves
Making a variation 「Wholesale Only」 on individual variations
The Permissions & Filters settings on the order form

The first two are related to WooCommerce Wholesale Prices Premium but affect all parts of your store (including the related products and the WooCommerce Wholesale Order Form page) and the last applies only to the WooCommerce Wholesale Order Form page.
1. Only Show Wholesale Products To Wholesale Users
This is a global setting which you can find under the Wholesale Prices settings page:

Login to WordPress
Navigate to WooCommerce->Settings
Click on the Wholesale Prices tab
Check the 「Only Show Wholesale Products To Wholesale Users」 option and save

Once this option is saved your store will check the user』s role and if they have a valid wholesale role it will determine if that product should be visible to that user by checking if there has been a wholesale price defined for that product.
This also respects the global % discount and also the product category % discount options (see our advanced wholesale pricing options guide for more info).
2. Restrict To Wholesale Roles
You can also restrict individual product visibility to certain roles only. This is really handy if you have multiple wholesale role tiers and need to restrict the visibility of particular products that get unlocked per role.
You will find this option on the Publish box of your individual products:
Restrict Wholesale Visibility
3. Restrict Variations To Wholesale Only
Have a Variable type product where you just need to make one variation 「wholesale only」?
You can achieve this by making the individual variation a 「Wholesale Exclusive Variation」. It』s as simple as checking a box next to the wholesale roles that should have permission to view this variation.

4. Permissions & Filters Settings in WooCommerce Wholesale Order Form
Our optimized WooCommerce order form plugin gives you the ability to further restrict what wholesale customers see on that page.
First off you can actually restrict access to this page via the user』s role. If they don』t have a role that has permission they will see an access denied screen instead.
Order Form Restrict Permissions
Numerous filters can also be set under the Filters screen in the settings. These include being able to restrict the order form to one particular category and also being able to exclude individual products from the list.
Order Form Filters
Having Product Visibility Problems?
Sometimes if you have used a product importer or bulk management tool you may need to re-initialize the product visibility meta which is used as an indicator for the system to identify which products to show to which users.
See here for instructions: How to re-initialize product visibility meta

How To Set A Default Country On Registration Form

How To Set A Default Country On Registration Form

If you typically accept most of your wholesale registrations from one country you might like to default the country to a specific one.
To do this currently in WooCommerce Wholesale Lead Capture you need to add a small snippet of code to your functions.php file in your theme:
// Change the default country on WooCommerce Wholesale Lead Capture's registration
function wwsSetRegistrationDefaultCountry() {

if ( is_page( 'wholesale-registration-page' ) ) {
?>

jQuery(document).ready(function () {
jQuery('select#wwlc_country').val('AU');
jQuery('select#wwlc_country').trigger('change');
});

<?php
}

}
add_action( 'wp_footer', 'wwsSetRegistrationDefaultCountry', 99 );

A few notes on implementing this code:

If you have renamed the registration page, it』s possible that the page slug has changed as well. Ensure you replace 『wholesale-registration-page』 in the code above with the correct page slug
The code above will default to 『AU』 which is Australia. Change this to whichever country you want to default to. You can find a list of 2-digit country codes here.

How To Add A Please Select Option To Custom Dropdown Fields

How To Add A Please Select Option To Custom Dropdown Fields

Custom fields in WooCommerce Wholesale Lead Capture let you add custom fields of many different types to your wholesale customer registration form.
Dropdown fields, in particular, are very powerful for forcing users to select from pre-defined options.
If you wish you can also add a 「— Please Select —」 which will have no value and therefore not pass validation if you mark the field required.
Instructions:
Add this option to your custom dropdown add your dropdown field via the custom fields interface in the settings (WooCommerce->Settings, Wholesale Lead, Custom Fields sub page) as per normal.
Then, add a new option to the list, giving it a display name such as 「— Please Select —」 while leaving the Option Value field empty.
Finally, move the field to the top of the list.
Adding a please select field to custom dropdowns
If you want to force users to select one of the options, ensure you have the 「Required」 setting enabled.
On the front end you will see your field like so (validation failure is shown):
Front end Please Select option

How to Style the Wholesale Registration and Log in Form

How to Style the Wholesale Registration and Log in Form

We』ve received a lot of request asking on how to style or customize the Wholesale Registration Form.
Unfortunately, we don』t have control of how our Wholesale Lead Capture forms will appear on the customer』s site. The WooCommerce Wholesale Lead Capture Forms includes some default styling based on WooCommerce used tags. And the styling basically relies on the active theme that is currently being used.
If you』d like to make some minor styling changes on the Wholesale Registration Form, a good way to modify them is by using custom CSS.
Listed below are some of the basic styling that you can use to modify your Wholesale Registration Form. You』ll need to put them on your theme/child theme』s style.css file to take effect.

/* Add another column */
div#wwlc-registration-form {
column-count: 2;
column-gap:60px;
}
/* Adjust the country field top margin*/
p#wwlc_country_field{
margin-top: 100%;
}
/* Adjust the country field dropdown size*/
#wwlc-registration-form span.select2-selection{
width:100%;
}
/* Adjust the field size and color */
#wwlc-registration-form .input-text.wwlc_form_field{
width:100%;
height:30px;
background-color: #f1f1f1;
}
If you don』t have an experience modifying custom CSS codes, I suggest checking other guides like this one which can help you modify your theme more efficiently.
Please note that extensive styling customization is not part of the plugin』s support scope. If you』re looking for further customization, we recommend hiring a designer/developer. And if you』re interested to hire one, we suggest someone from Codeable.

How to hide the Phone field on the registration page

How to hide the Phone field on the registration page

At the moment, we don』t have an option to hide the Phone field in the Wholesale Registration page.
But you can simply use the CSS code below to hide it. Please put this on your theme』s style.css to apply the change.
#wwlc-registration-form .wwlc_phone {display:none;}

Remember to make sure that the phone field is set to be 『not required』 in the WooCommerce > Settings > Wholesale Lead tab > Built-in Fields sub-menu.

How to Remove Other Countries on the Registration Form

How to Remove Other Countries on the Registration Form

By default, we don』t have a feature to remove other countries on the country dropdown of the Wholesale Registration Page.
Fortunately, there is an easy workaround by using the custom snippet below and adding it to your theme/child theme』s functions.php
// Change the country list of the registration form
add_filter( 'woocommerce_form_field_args', 'my_wwlc_set_country');
function my_wwlc_set_country($args){

// Set the country list
if($args['id'] == 'wwlc_country'){
$args['options'] = array(
'AU' => 'Australia',
'US' => 'United States'
);
}

// Return the modified list
return $args;
}

Please note that the code above needs to use the correct 2 digit country code. For example, 『AU』 for Australia, and 『US』 for United States. You can replace or add more countries by following that format. Kindly visit this link to get the list of 2-digit country codes.
Also, sometimes the state or provinces doesn』t automatically load when you remove other countries. This code below can be added to load the state automatically.
add_action( 'wp_footer' , function() {
global $post;
if( ( isset( $post->post_content ) && has_shortcode( $post->post_content , 'wwlc_registration_form' ) ) ) { ?>

jQuery(document).ready(function(){
jQuery("#wwlc_country").trigger("change");
});

<?php }
}, 100 );

How To Override Login & Registration Form Templates

How To Override Login & Registration Form Templates

The WooCommerce Wholesale Lead Capture plugin gives your wholesale customers a great way to register and login to the wholesale side of your website.
But sometimes you might need to customize the layout of the registration or login forms or do other layout tweaks to take what the plugin offers even further.
That』s where template overrides come in.
The Lead Capture plugin lets you override its templates in much the same way as WooCommerce itself does, so those that are familiar with WooCommerce』s template overriding will find this just as simple.
To override a template file:

Navigate to the /wp-content/plugins/woocommerce-wholesale-lead-capture/templates/ directory
Copy the .php file you wish to override
Paste the file in your theme under a directory called 『woocommerce』. This should look something like: /wp-content/themes/your-theme/woocommerce/[template file to override].php

The plugin will search your theme and detect these overrides and use them over the bundled plugin versions.
Keep in mind, when you update the plugin, sometimes template files will need to be updated to keep up with the latest features.

How To Troubleshoot Emails Not Sending

How To Troubleshoot Emails Not Sending

Are your customers having trouble receiving the email coming from your store』s Lead Capture plugin?
There are a variety of different ways that email deliverability can be affected.
Please go through the following three troubleshooting steps and contact support if further assistance is required.
#1. Customise the subject lines and email content of your Lead Capture emails
Some providers are more sensitive than others and they have different filters and rules to mark an email as spam. The content of your email could be triggering spam filters on the receiver』s email service which would cause the emails to be blocked even before they get to the account.
This type of rejection happens a lot on big email providers like Gmail, Hotmail and Yahoo who are very sophisticated about how spam is handled.
Try changing the subject on your emails. You can do this easily under WooCommerce->Settings, Lead Capture tab, Emails settings page.
Suggestion: Instead of the default 「Registration Approved」 try something more specific and less likely to trigger a spam filter such as 「Your wholesale registration was approved on XYZ Store」
Also alter the body content of the emails to make them more specific to your store and less standardised.
#2. Ensure your domain is allowed to send emails from that FROM address
If you are routinely experiencing email deliverability issues but it seems random (eg. its a problem for some users but not others) then it』s likely not related to your WordPress/WooCommerce installation but more to do with your domain. You are likely experiencing a policy based rejection.
To fix this, the email address you are sending FROM (as set in both Settings->General and WooCommerce->Settings, Emails tab) must be allowed to send from your domain.
This means if you have a yahoo.com email address in those settings, it』s likely that the receiving server is checking against your domain to see if it』s allowed to send on behalf of yahoo.com (which it isn』t).
Suggestion: Try the following which should enhance the reputation of your domain and avoid most policy based rejections.

Setup an email account on your domain, eg. [email protected], which will serve as the FROM address for all your website』s emails. Set this address as the email address under Settings->General and also the From address under WooCommerce->Settings, Emails tab.
Contact a web developer or your web host to ask what the proper DKIM, SPF and DMARC settings should be on your domain to ensure email deliverability.

See here for more information about policy based rejections.
#3. Try using an SMTP server for sending emails instead
If the above two tips don』t get the emails flowing, then it might be possible to switch to using an SMTP server for sending your emails instead.
This can be done by using SMTP via your web host (contact your host about sending emails via SMTP with your hosting account) or via a transactional email sending service like SendGrid, Mandrill or MailGun. Transactional API based services are generally better for large stores to ensure enhanced deliverability.
Click here to read about how to enable SMTP sending on your WordPress installation.
Still experiencing issues with email deliverability?
Please ensure you have tried all three of the above troubleshooting steps before contacting support.
If you are still experiencing trouble, please get in touch and we will do our best to help you diagnose the issue.

How To Add Wholesale Ordering link In My Account Page

How To Add Wholesale Ordering link In My Account Page

A common request we have had is how to display a wholesale ordering link on the My Account Page so that wholesale customers see a link to the WooCommerce Wholesale Order Form on the page they land on after they log in.
By using the custom snippet below, you can now include an additional tab for the Wholesale Order Form on the My Account Page.
Just simply edit the URL in the snippet to redirect your customers to your respective Wholesale Order Form URL.
add_filter ( 'woocommerce_account_menu_items', 'wholesale_ordering_link' );
function wholesale_ordering_link( $menu_links ){

$new = array( 'wholesaleorderinglink' => 'Wholesale Ordering Form' );

$menu_links = array_slice( $menu_links, 0, 1, true )
+ $new
+ array_slice( $menu_links, 1, NULL, true );

return $menu_links;

}

add_filter( 'woocommerce_get_endpoint_url', 'wholesale_ordering_hook_endpoint', 10, 4 );
function wholesale_ordering_hook_endpoint( $url, $endpoint, $value, $permalink ){

if( $endpoint === 'wholesaleorderinglink' ) {

// here is the place for your custom wholesale ordering page URL
$url = 'http://localhost/wholesale/wholesale-ordering/';

}
return $url;

}
You can add this custom snippet to your theme/child theme』s functions.php. Afterward, your My Account page should now display the Wholesale Order Form tab.
Wholesale Order Form on My Account PageWholesale Order Form on My Account Page

How to hide/disable the add to cart button based on product type

How to hide/disable the add to cart button based on product type

If you』re looking for a way to restrict your wholesale user from purchasing products with a specific product type, for example, you want to prevent them from purchasing simple products, variable products or even product bundles, you can do that by using a custom snippet.
The snippet below is an example to hide the add to cart button on the product and product catalog page. It checks if the logged in user is a wholesale customer based on the wholesale role key and if it is a simple product. Then it hides/disables the add to cart button.
 
add_action('wp','wwp_remove_add_to_cart_on_product_type', 99);

function wwp_remove_add_to_cart_on_product_type() {
global $current_user;
$product = wc_get_product();

if (isset($current_user) && class_exists('WWP_Wholesale_Roles')) {
$wwp_wholesale_roles = WWP_Wholesale_Roles::getInstance();
$wwp_wholesale_role = $wwp_wholesale_roles->getUserWholesaleRole();

//Checks if the logged in user is wholesale_customer
if (!empty($wwp_wholesale_role) && in_array('wholesale_customer', $wwp_wholesale_role)) {

// Change the product type, in this example it is 'simple' for simple products
if ( $product instanceof WC_Product && $product->is_type( 'simple' ) ) {
// This filter will disable the add to cart button
add_filter( 'woocommerce_is_purchasable', '__return_false');
}
}
}
}

 
If you wish to hide these products from your WooCommerce Wholesale Order Form, you』ll need to do an additional step to hide them. You can go to  WooCommerce > Settings > Wholesale Ordering > Filters, and add the products in the Exclude Product Filter.
 
Exclude Product Filter, WooCommerce Wholesale Order Form