Sets all Billing fields on WooCommerce checkout to required
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
/** | |
* Sets all WooCommerce billing fields to be required. | |
*/ | |
function wc_require_billing_fields( $fields ) { | |
$fields['billing_first_name']['required'] = true; | |
$fields['billing_last_name']['required'] = true; | |
$fields['billing_company']['required'] = true; | |
$fields['billing_country']['required'] = true; | |
$fields['billing_address_1']['required'] = true; | |
$fields['billing_city']['required'] = true; | |
$fields['billing_state']['required'] = true; | |
$fields['billing_postcode']['required'] = true; | |
$fields['billing_phone']['required'] = true; | |
$fields['billing_email']['required'] = true; | |
return $fields; | |
} | |
add_filter( 'woocommerce_billing_fields', 'wc_require_billing_fields' ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment