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:test
- 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.