Created
March 28, 2025 17:33
-
-
Save greenhornet79/81dba27e67de95f9d7decd7e80c2617a 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
<?php | |
add_filter('leaky_paywall_basic_shipping_validation', 'zeen_ignore_state_for_international', 10, 2); | |
function zeen_ignore_state_for_international($errors, $fields) | |
{ | |
// if the user selects GB (Great Britian), then remove the state validation | |
if ($fields['country'] == 'GB') { | |
unset($errors['state_empty']); | |
} | |
return $errors; | |
} | |
add_action('wp_footer', 'zeen_remove_state_field'); | |
function zeen_remove_state_field() | |
{ | |
// if the country selected is GB (Great Britian), then remove the state field | |
?> | |
<script> | |
(function($) { | |
$(document).ready(function() { | |
$('#country').change(function() { | |
country = this.value; | |
if (country == 'GB') { | |
$('.state-field').hide(); | |
} else { | |
$('.state-field').show(); | |
} | |
}); | |
}); | |
})(jQuery); | |
</script> | |
<?php | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment