mirror of
https://gh.wpcy.net/https://github.com/mainwp/Code-Snippets-Functions.git
synced 2026-05-01 11:52:25 +08:00
https://stackoverflow.com/questions/66953728/unset-some-woocommerce-checkout-billing-fields-and-one-page-checkout-plugin/66953977
15 lines
581 B
Text
15 lines
581 B
Text
add_filter( 'woocommerce_default_address_fields', 'customize_default_address_checkout_fields', 1000 );
|
|
function customize_default_address_checkout_fields( $fields ) {
|
|
if( is_checkout() ) {
|
|
$fields['first_name']['required'] = $fields['last_name']['required'] = false;
|
|
}
|
|
return $fields;
|
|
}
|
|
|
|
add_filter( 'woocommerce_billing_fields', 'customize_billing_checkout_fields', 1000 );
|
|
function customize_billing_checkout_fields( $fields ) {
|
|
if( is_checkout() ) {
|
|
unset($fields['billing_first_name'], $fields['billing_last_name']);
|
|
}
|
|
return $fields;
|
|
}
|