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' ) ) {
        ?>
 
        <script type="text/javascript">
            jQuery(document).ready(function () {
                jQuery('select#wwlc_country').val('AU');
                jQuery('select#wwlc_country').trigger('change');
            });
        </script>
 
        <?php
    }
 
}
add_action( 'wp_footer', 'wwsSetRegistrationDefaultCountry', 99 );

A few notes on implementing this code:

  1. If you have renamed the registration page, it’s possible that the page slug has change as well. Ensure you replace ‘wholesale-registration-page’ in the code above with the correct page slug
  2. 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.

in WooCommerce Wholesale Lead Capture

Solve The Big Three Problems With Wholesaling In WooCommerce

Add wholesale pricing to products   Streamline your ordering   Register & manage wholesale customer

Explore The Plugin Suite  

[data-image-id='gourmet_bg']
[data-image-id='gourmet_bg']
[data-image-id='gourmet_bg']
[data-image-id='gourmet_bg']
[data-image-id='gourmet_bg']
[data-image-id='gourmet_bg']
[data-image-id='gourmet']
[data-image-id='gourmet']
[data-image-id='gourmet']
[data-image-id='gourmet']
[data-image-id='gourmet']
[data-image-id='gourmet']
[data-image-id='gourmet']
[data-image-id='gourmet']
[data-image-id='gourmet']
[data-image-id='gourmet']