Skip to content

Instantly share code, notes, and snippets.

@stuartduff
Last active January 23, 2019 14:41
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save stuartduff/341e3198ac3a9a02464c4d292689c055 to your computer and use it in GitHub Desktop.
Save stuartduff/341e3198ac3a9a02464c4d292689c055 to your computer and use it in GitHub Desktop.
Removes the required status for all WooCommerce Checkout Billing Fields
/**
* Sets all WooCommerce billing fields to be unrequired.
*/
function wc_unrequire_billing_fields( $fields ) {
$fields['billing_first_name']['required'] = false;
$fields['billing_last_name']['required'] = false;
$fields['billing_company']['required'] = false;
$fields['billing_country']['required'] = false;
$fields['billing_address_1']['required'] = false;
$fields['billing_city']['required'] = false;
$fields['billing_state']['required'] = false;
$fields['billing_postcode']['required'] = false;
$fields['billing_phone']['required'] = false;
$fields['billing_email']['required'] = false;
return $fields;
}
add_filter( 'woocommerce_billing_fields', 'wc_unrequire_billing_fields' );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment