Woocommerce中的国家国家/地区的自定义列表 [英] Custom list of states countries in Woocommerce
本文介绍了Woocommerce中的国家国家/地区的自定义列表的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我正在尝试列出一些国家/地区的自定义列表.我知道如何为各州做到这一点.我用过
I am trying to make a custom list of countries . I know how to make it for states . I have used
add_filter( 'woocommerce_states', 'custom_woocommerce_states' );
function custom_woocommerce_states( $states ) {
$states['IN'] = array(
'PB' => 'Punjab'
);
return $states;
}
用于州.但是如何制作自定义国家/地区列表?
For making it for states . But how to make a custom list of countries ?
推荐答案
这是您想要的吗?
add_filter('woocommerce_countries','custom_country', 10, 1);
function custom_country($mycountry){
$mycountry = array(
'AF' => __( 'Afghanistan', 'woocommerce' ),
'IN' => __( 'India', 'woocommerce' )
);
return $mycountry;
}
这篇关于Woocommerce中的国家国家/地区的自定义列表的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文