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