你好,我想增加电话号码
<span class="woocommerce-input-wrapper"><input type="tel" class="input-text " name="billing_phone" id="billing_phone" placeholder="" value="050943587" minlength="9" maxlength="9" autocomplete="tel"></span>
就像这里显示的它是9我想把它增加到11我不知道怎么写过滤器也不知道在哪里添加
你可以在我的结帐页面看到:https://raaia.com
您需要使用woocommerce_checkout_fields
钩子。您将收到所有结帐字段,您可以通过更改数组的键来更改HTML属性,如下所示:
// Hook your function
add_filter( 'woocommerce_checkout_fields' , 'custom_override_checkout_fields' );
// Alter shipping phone values
function custom_override_checkout_fields( $fields ) {
$fields['billing']['billing_phone']['minlength'] = 9;
$fields['billing']['billing_phone']['maxlength'] = 11;
return $fields;
}