Created
August 25, 2026 13:19
-
-
Save xlplugins/1ca0ab434b181b60911075b15be0d464 to your computer and use it in GitHub Desktop.
remove prefill billing country state value
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
| 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