Skip to content

Instantly share code, notes, and snippets.

@xadapter
Created June 16, 2016 06:49
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save xadapter/ab7a6789d270b214dc04ad0a645613fc to your computer and use it in GitHub Desktop.
Save xadapter/ab7a6789d270b214dc04ad0a645613fc to your computer and use it in GitHub Desktop.
WooCommerce - Unset the required property of fields on checkout page.
add_filter( 'woocommerce_checkout_fields' , 'xa_checkout_change_required_fields_to_optional' );
function xa_checkout_change_required_fields_to_optional( $fields ) {
$fields['billing']['billing_address_1']['required'] = false;
$fields['billing']['billing_address_2']['required'] = false;
$fields['billing']['billing_postcode']['required'] = false;
$fields['billing']['billing_city']['required'] = false;
$fields['billing']['billing_phone']['required'] = false;
return $fields;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment