How to restrict shipping countries list on Woocommerce checkout page?

In this tutorial we’ll learn how to restrict customers to place orders from specific countries only. Often store owners ship to only one or some countries and they don’t want customers to place orders from other countries. If you are having the same issue, don’t worry we can help you out there.

If you add some products to cart and proceed to checkout page you’ll see the default country dropdown in Woocommerce:


Now we’ll reduce this to one country only. Let’s say a store owner will only want to display ‘Austarlia’ as shipping/billing country. Add the following lines of code at the end of your theme’s functions.php file.

function woo_override_checkout_fields( $fields ) { 

	$fields['shipping']['shipping_country'] = array(
		'type'      => 'select',
		'label'     => __('My New Country List', 'woocommerce'),
		'options' 	=> array('AU' => 'Australia')

	return $fields; 
add_filter( 'woocommerce_checkout_fields' , 'woo_override_checkout_fields' );

Now if you refresh the page you’ll see only australia as only country for shipping/billing addresses.


About the author

We provide WordPress & WooCommerce Support, Maintenance and Development Services.

Leave a Reply