我有3个结帐自定义字段(由第三方插件生成),如果这些字段中已经记录了数据,我想禁用它们。 字段为:“ billing_cpf”,“ billing_rg”和“ billing_birthdate”以及“结算”部分的其他字段。
我正在使用此功能禁用网站所有用户已填写的某些字段的填写。但是,我想为以前填写过的用户禁用其他几个字段。
// Disable WooCommerce Checkout Fields.
add_filter( 'woocommerce_checkout_fields' , 'disable_checkout_fields' );
function disable_checkout_fields( $fields ) {
$fields['billing']['billing_first_name']['custom_attributes'] = array( 'disabled' => true );
//$fields['billing']['billing_last_name']['custom_attributes'] = array( 'disabled' => true );
//$fields['billing']['billing_cpf']['custom_attributes'] = array( 'disabled' => true );
//$fields['billing']['billing_country']['custom_attributes'] = array( 'disabled' => true );
//$fields['billing']['billing_company']['custom_attributes'] = array( 'disabled' => true );
//$fields['billing']['billing_address_1']['custom_attributes'] = array( 'disabled' => true );
//$fields['billing']['billing_address_2']['custom_attributes'] = array( 'disabled' => true );
//$fields['billing']['billing_city']['custom_attributes'] = array( 'disabled' => true );
//$fields['billing']['billing_state']['custom_attributes'] = array( 'disabled' => true );
//$fields['billing']['billing_postcode']['custom_attributes'] = array( 'disabled' => true );
//$fields['billing']['billing_phone']['custom_attributes'] = array( 'disabled' => true );
$fields['billing']['billing_email']['custom_attributes'] = array( 'disabled' => true );
return $fields;
}