Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Select an option

  • Save xlplugins/1ca0ab434b181b60911075b15be0d464 to your computer and use it in GitHub Desktop.

Select an option

Save xlplugins/1ca0ab434b181b60911075b15be0d464 to your computer and use it in GitHub Desktop.
remove prefill billing country state value
add_action( 'wp_footer', function () {
if ( ! function_exists( 'WFACP_Core' ) ) {
return;
}
?>
<script>
jQuery( function ( $ ) {
$( document.body ).on( 'change', '#billing_same_as_shipping,.billing_same_as_shipping', function () {
var $el = $( this );
var different = ( 'radio' === $el.prop( 'type' ) ) ? ( 'option_2' === $el.val() ) : $el.is( ':checked' );
if ( ! different ) {
return;
}
$( '#billing_state' ).val( '' ).trigger( 'change', { 'aero_do_not_state_service': true } );
$( '#select2-billing_state-container' ).text( '' ).removeAttr( 'title' );
$( '#billing_country' ).val( '' ).trigger( 'change' );
$( '#billing_state_field, #billing_country_field' )
.removeClass( 'woocommerce-invalid woocommerce-invalid-required-field' );
} );
} );
</script>
<?php
} );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment