Skip to content

Instantly share code, notes, and snippets.

@twern
Created March 6, 2017 12:16
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 twern/809e7e353b862c661ec35bf2ccde6c48 to your computer and use it in GitHub Desktop.
Save twern/809e7e353b862c661ec35bf2ccde6c48 to your computer and use it in GitHub Desktop.
German Market - Filter - USTID Pflichtfeld
// Vat Number field is required in checkout
add_filter( 'woocommerce_billing_fields', 'my_woocommerce_billing_fields_vat_nr_is_required' );
/**
* Vat Number field is required in checkout
*
* @author MarketPress
* @wp-hook woocommerce_billing_fields
* @param Array $address_fields
* @return Array
**/
function my_woocommerce_billing_fields_vat_nr_is_required( $address_fields ) {
if ( isset( $address_fields[ 'billing_vat' ] ) ) {
$address_fields[ 'billing_vat' ][ 'required' ] = true;
}
return $address_fields;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment