Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/wordpress/12.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Php 如何在商业中找到任何国家/地区的州/市_Php_Wordpress_Woocommerce_Location_Country - Fatal编程技术网

Php 如何在商业中找到任何国家/地区的州/市

Php 如何在商业中找到任何国家/地区的州/市,php,wordpress,woocommerce,location,country,Php,Wordpress,Woocommerce,Location,Country,我知道,通过以下方法,我可以在商业上获得国家: global $woocommerce; $woocommerce->customer->get_shipping_country() 或 但我想知道如何找到任何国家/地区的州/市。在WooCommerce中,您只能通过以下方式从国家/地区获取州(或地区): $country_code = WC()->customer->get_shipping_country(); $states_array = WC()->c

我知道,通过以下方法,我可以在商业上获得国家:

global $woocommerce;
$woocommerce->customer->get_shipping_country()


但我想知道如何找到任何国家/地区的州/市。

在WooCommerce中,您只能通过以下方式从国家/地区获取州(或地区):

$country_code = WC()->customer->get_shipping_country();

$states_array = WC()->countries->get_states( $country_code ); // States array for a country
您可以通过以下方式获取客户发货状态:
WC()->customer->get_shipping_state()
您可以通过以下方式获取客户配送城市:
WC()->customer->get_shipping_city()

$country_code = WC()->customer->get_shipping_country();

$states_array = WC()->countries->get_states( $country_code ); // States array for a country