Woocommerce - Remove country field in cart shippin

2019-01-25 23:03发布

问题:

How would I have Australia selected by default and have the input field not displaying heres an example of what im talking about I am using woocommerce:

I'm sure there is a simple function for this or setting in the back end but can't seem to find a solution :(

回答1:

Paste following code into your function.php file to Remove country field in checkout page:

function custom_override_checkout_fields( $fields )    
{
unset($fields['billing']['billing_country']);
return $fields;
}
add_filter('woocommerce_checkout_fields','custom_override_checkout_fields');


回答2:

You can set your store to only sell to Australia in the WooCommerce Settings> General Settings in the "Specific Countries" field

This should remove the Country option from the checkout. With "Australia" set in the above settings here is the result in Twenty Fourteen: