Last active
March 24, 2017 11:18
-
-
Save rynaldos-zz/31fdcac87f5a88c84bf6 to your computer and use it in GitHub Desktop.
[WooCommerce] Make the EU-VAT field required during checkout (and add asterisk)
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
add_action('woocommerce_checkout_process', 'wc_force_vat_field_to_be_not_empty'); | |
function wc_force_vat_field_to_be_not_empty() { | |
// Check if set, if its not set add an error. | |
if ( ! $_POST['vat_number']); | |
wc_add_notice( __( 'Please enter your VAT number.' ), 'error' ); | |
} | |
// adding the asterisk (css) | |
body.woocommerce-checkout .address-field.vat-number label:after { | |
content: " *"; | |
color: red; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment