场景:
客户是在迪拜,涉及到不同地区运费问题。令人惊奇的是Woocommerce嫌弃迪拜太小,根本没有分地区,我直接和客户小妹说:这活干不了,对,迪拜那么小还整这么多运费,烦不烦,客户不能这么惯着,今天改这,明天改那的,烦死了。
大约10分钟后,老板娘的微信语音来了。
我麻溜的接起语音:“姐,我在的……”
那就干吧,直接上代码,加载functions.php种:
add_filter('woocommerce_states', 'add_country_states'); function add_country_states( $states ) { // If states already exist for "AE" country (add it to existing ones) if( isset($states['AE'] ) ) { $states['AE']['DU'] = __('Dubai', 'woocommerce'); } // IF states doesn't exist for "AE" country add the new states else { // One state by line in the array with its code as key $states['AE'] = array( 'Dubai' => __('Dubai', 'woocommerce'), 'ABU'=>__('ABU Dhabi', 'woocommerce'), 'Sharjah'=>__('Sharjah', 'woocommerce'), 'Achman'=>__('Achman', 'woocommerce'), 'Umgewan'=>__('Umgewan', 'woocommerce'), 'Khaimah'=>__('Khaimah Point', 'woocommerce'), 'Fujairah'=>__('Fujairah', 'woocommerce'), ); } return $states; }
很快,弄完后给客户小妹截图,她一定在想,刚才还说弄不了的,看来还是老板娘好使……
倒是我尴尬了……