How to Restrict B2BKing Access to a Single Country (e.g., Australia)
Website Technical Support
Author: Leo MA
15/08/2025
If you’re running a B2B store using B2BKing on WordPress, limiting access or visibility to specific countries can be an essential part of your strategy. Whether you’re targeting a single market like Australia or complying with regional business policies, B2BKing offers a straightforward way to control which countries your users can interact from.
In this guide, we’ll show you how to restrict access to only one country in B2BKing — using Australia as an example.
Why Restrict by Country?
For many B2B businesses, regional targeting is critical. Limiting access to a single country allows you to:
Focus marketing efforts on one demographic.
Streamline shipping and taxation.
Avoid unnecessary international inquiries.
Ensure compliance with local laws and trading standards.
Step-by-Step: How to Set Country Restrictions in B2BKing
Here’s how you can configure B2BKing to accept registrations and interactions only from Australia:
Access the B2BKing Dashboard
Log in to your WordPress admin panel and go to B2BKing > Settings.
Navigate to the Registration Settings
Within the B2BKing settings panel, locate the Registration & Approval section.
Enable Country Restrictions
B2BKing provides a built-in filter where you can restrict available billing or shipping countries.
Add this code to your
functions.phpfile or a site-specific plugin to allow only Australia:
/* — Countries: AU only — */
add_filter( ‘woocommerce_countries’, function ( $countries ) {
return array( ‘AU’ => __( ‘Australia’, ‘woocommerce’ ) );
}, 10 );/* — Store default country — */
add_filter( ‘woocommerce_default_country’, function () {
return ‘AU’;
}, 10 );/* — Default address state (global) — */
add_filter( ‘woocommerce_default_address_fields’, function ( $fields ) {
if ( isset( $fields[‘state’] ) ) {
$fields[‘state’][‘default’] = ‘NSW’;
}
return $fields;
}, 10 );/* — Checkout defaults + remove label/floating on country field — */
add_filter( ‘woocommerce_checkout_fields’, function ( $fields ) {
// Billing defaults
if ( isset( $fields[‘billing’] ) ) {
if ( isset( $fields[‘billing’][‘billing_country’] ) ) {
$fields[‘billing’][‘billing_country’][‘default’] = ‘AU’;
$fields[‘billing’][‘billing_country’][‘label’] = ”;
$fields[‘billing’][‘billing_country’][‘placeholder’] = ”;
if ( ! empty( $fields[‘billing’][‘billing_country’][‘class’] ) && is_array( $fields[‘billing’][‘billing_country’][‘class’] ) ) {
$fields[‘billing’][‘billing_country’][‘class’] = array_values( array_diff(
$fields[‘billing’][‘billing_country’][‘class’],
array( ‘ast-animate-input’ )
) );
}
}
if ( isset( $fields[‘billing’][‘billing_state’] ) ) {
$fields[‘billing’][‘billing_state’][‘default’] = ‘NSW’;
}
}
// Shipping (if enabled)
if ( isset( $fields[‘shipping’] ) ) {
if ( isset( $fields[‘shipping’][‘shipping_country’] ) ) {
$fields[‘shipping’][‘shipping_country’][‘default’] = ‘AU’;
$fields[‘shipping’][‘shipping_country’][‘label’] = ”;
$fields[‘shipping’][‘shipping_country’][‘placeholder’] = ”;
if ( ! empty( $fields[‘shipping’][‘shipping_country’][‘class’] ) && is_array( $fields[‘shipping’][‘shipping_country’][‘class’] ) ) {
$fields[‘shipping’][‘shipping_country’][‘class’] = array_values( array_diff(
$fields[‘shipping’][‘shipping_country’][‘class’],
array( ‘ast-animate-input’ )
) );
}
}
if ( isset( $fields[‘shipping’][‘shipping_state’] ) ) {
$fields[‘shipping’][‘shipping_state’][‘default’] = ‘NSW’;
}
}
return $fields;
}, 20 );/* — CSS/JS failsafe: hide label and disable floating even after AJAX refresh — */
add_action( ‘wp_footer’, function () {
if ( ! is_checkout() ) return;
?>
<style id=”wc-au-only-fix”>
#billing_country_field > label,
#shipping_country_field > label { display: none !important; }
#billing_country_field .woocommerce-input-wrapper strong,
#shipping_country_field .woocommerce-input-wrapper strong {
display: inline-block !important; margin: 0 0 8px !important; font-weight: 600;
}
</style>
<script>
(function(){
function fixCountryRow(id){
var row = document.getElementById(id);
if(!row) return;
row.classList.remove(‘ast-animate-input’);
var label = row.querySelector(‘:scope > label’);
if(label){ label.style.display = ‘none’; }
}
function run(){ fixCountryRow(‘billing_country_field’); fixCountryRow(‘shipping_country_field’); }
document.addEventListener(‘DOMContentLoaded’, run);
window.addEventListener(‘load’, run);
if (window.jQuery) { jQuery(document.body).on(‘updated_checkout’, run); }
new MutationObserver(run).observe(document.body, { childList:true, subtree:true });
})();
</script>
<?php
}, 999 );———————-
Optional: Customize Country Dropdown
If you’re using custom registration forms, you may also want to limit the country options shown to users. This ensures that only eligible businesses from your target country can register.
Test the Changes
Log out and try to register as a new user to ensure that only Australia is selectable or allowed. Make sure all pages behave as expected with the restriction in place.
Final Thoughts
Restricting access to specific countries is a powerful way to tailor your B2B eCommerce strategy. B2BKing makes it easy to manage this kind of advanced configuration without complex plugins or workarounds.
Focusing on a single market like Australia? This setup helps keep your processes lean, compliant, and aligned with your business goals.
If you need help configuring your B2B store for regional targeting or want a fully optimized WordPress setup, reach out — we’re here to support your growth.
