Would you like to limit billing to a single country for your store’s checkout page? If you’re running a store and want to customize the checkout process by simplifying the country selection, this code snippet is your solution! This piece of code modifies the country field dropdown to a specific country in the billing section on your checkout page.
function ts_checkout_fields_billing( $fields ) { $fields['billing']['billing_country'] = array( 'type' => 'select', 'label' => __('Country', 'woocommerce'), 'options' => array('IN' => 'India') ); return $fields; } add_filter( 'woocommerce_checkout_fields' , 'ts_checkout_fields_billing' );
Output
When the customer visits the checkout page, it will display only one country from the dropdown menu with one choice – in this case, ‘India’ as shown below.
Alternatively, you can also remove default value of country & state field in WooCommerce checkout , preventing it from being auto-populated.