Im beginner for the word press , I don't know if the issue is because of the . The problem is that the "calculate shipping" option on my cart page doesn't allow users to select my country / state list, only allowed postal code

i want to know How to add Woocomrce cart page shipping calculator to my country state list, reason my country state list not here

example

enter image description here

up vote 1 down vote accepted

Add this snippet to the functions.php file of your theme to add a new country to the WooCommerce countries list.

add_filter('woocommerce_states', 'sa_woocommerce_states'); add_filter('woocommerce_countries_allowed_country_states','sa_woocommerce_state');

function SA_woocommerce_states( $states ) {

$states['ZA']['EC'] = __('Eastern Cape', 'woocommerce');
return $states;

}

  • Hello Sir, whare's to put Dubai > state list – core114 Nov 29 at 10:34
  • ok i edit code please wait – vikrant zilpe Nov 29 at 10:36
  • sir, i added this its not working ,selected state option are empty – core114 Nov 29 at 10:44
  • you add state in code – vikrant zilpe Nov 29 at 10:47
  • 1
    i am edit code please try – vikrant zilpe Nov 29 at 10:54

Your Answer

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Not the answer you're looking for? Browse other questions tagged or ask your own question.