Created
September 14, 2022 13:06
-
-
Save jamesckemp/1f37f3c6fe901783aad23d937c86a8b3 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* Modify max length of first name field in WooCommerce. | |
* | |
* @param array $fields | |
* | |
* @return array | |
*/ | |
function flux_modify_fname_field_length( $fields ) { | |
if ( isset( $fields['billing']['billing_first_name'] ) ) { | |
$fields['billing']['billing_first_name']['maxlength'] = 20; | |
} | |
if ( isset( $fields['shipping']['shipping_first_name'] ) ) { | |
$fields['shipping']['shipping_first_name']['maxlength'] = 20; | |
} | |
return $fields; | |
} | |
add_filter( 'woocommerce_checkout_fields', 'flux_modify_fname_field_length', 1001 ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment