Last active
January 23, 2019 14:41
-
-
Save stuartduff/341e3198ac3a9a02464c4d292689c055 to your computer and use it in GitHub Desktop.
Removes the required status for all WooCommerce Checkout Billing Fields
This file contains hidden or 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 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