Last active
May 19, 2024 19:23
-
-
Save MaximilianoRicoTabo/3f2c1d8f0c18794f70adde255ac8e1c5 to your computer and use it in GitHub Desktop.
Make Italia default selected country for country and estate dropdown Add On.
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 | |
function make_italia_default_selected_country() { | |
global $pmpro_pages; | |
if ( is_page( $pmpro_pages['checkout'] ) ) { | |
?> | |
<script> | |
//Dom ready | |
jQuery('document').ready(function($) { | |
$('#bcountry').val("IT"); | |
$('#bcountry').trigger('change'); | |
//Remove line below if you don't want to hide country selector. | |
$('#bcountry').closest('.pmpro_checkout-field-bcountry').hide(); | |
}); | |
</script> | |
<?php | |
} | |
} | |
add_action( 'wp_footer', 'make_italia_default_selected_country', 10 ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment