【发布时间】:2017-05-08 05:16:05
【问题描述】:
我必须在结帐页面的选择框中仅显示允许的送货国家/地区。我使用下面的代码添加了我的自定义列表,但它破坏了自动完成功能并留下正常选择(屏幕截图上的红色边框)。
如何只添加自定义国家并保持自动完成?
function woo_override_checkout_fields( $fields ) {
$fields['shipping']['shipping_country'] = array(
'type' => 'select',
'required'=>true,
'label' => __('Country', 'shop'),
'options' => getAllowedCountries()
);
$fields['billing']['billing_country'] = array(
'type' => 'select',
'required'=>true,
'label' => __('Country', 'shop'),
'options' => getAllowedCountries()
);
return $fields;
}
add_filter( 'woocommerce_checkout_fields' , 'woo_override_checkout_fields' );
【问题讨论】:
标签: javascript php wordpress woocommerce hook-woocommerce