Created
January 27, 2021 14:30
-
-
Save blivic/c9bd4319e6be38eed2cf6a4c2a240408 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
/** | |
* Hide R1 field for customers outside HR | |
**/ | |
add_action( 'woocommerce_after_checkout_form', 'mx_show_r1_4hr' ); | |
function mx_show_r1_4hr(){ | |
if ( is_checkout() ) { | |
?> | |
<script> | |
jQuery(document).ready(function($){ | |
$(document).on('updated_checkout', function(){ | |
if ($('#billing_country').find('option:selected').val() == 'HR'){ | |
$('#mx_custom_checkout_field').show(); | |
} else { | |
$('#mx_custom_checkout_field').hide(); | |
} | |
}); | |
}); | |
</script> | |
<?php | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment