Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // WooCommerce - Do not allow the user to select the 'default' country
- add_action( 'woocommerce_after_checkout_validation', 'custom_validate_country', 10, 2 );
- function custom_validate_country( $data, $errors ) {
- if( 'default' == $data['billing_country'] ) {
- $errors->add( 'validation', 'Please select a billing country' );
- } else {
- if( 'default' == $data['shipping_country'] ) {
- $errors->add( 'validation', 'Please select a shipping country' );
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement