Created
January 13, 2016 11:09
-
-
Save rynaldos-zz/fb140f1fdc721bd79ca9 to your computer and use it in GitHub Desktop.
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
/** | |
* Force VAT field to be filled | |
*/ | |
add_action('woocommerce_checkout_process', 'wc_force_vat_field_to_be_not_empty'); | |
function wc_force_vat_field_to_be_not_empty() { | |
global $woocommerce; | |
// Check if set, if its not set add an error. | |
if( $woocommerce->customer->get_country() != 'SE' ) { | |
if ( ! $_POST['vat_number'] ) | |
wc_add_notice( __( 'Please enter your VAT number.' ), 'error' ); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment