Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Sets all Billing fields on WooCommerce checkout to required
/**
* 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