Last active
December 24, 2025 11:39
-
-
Save xlplugins/854212eda7040b66160a48f071c2f266 to your computer and use it in GitHub Desktop.
Ensure wfacp-form-control class exists on billing state and city fields
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( 'wfacp_internal_css', function() { | |
| ?> | |
| <script> | |
| (function($) { | |
| function addClassIfMissing() { | |
| var $fields = $('#billing_state, #billing_city'); | |
| $fields.each(function() { | |
| if (!$(this).hasClass('wfacp-form-control')) { | |
| $(this).addClass('wfacp-form-control'); | |
| } | |
| }); | |
| } | |
| // Run on page load | |
| window.addEventListener('bwf_checkout_load', addClassIfMissing); | |
| // Run on checkout update | |
| $(document.body).on('updated_checkout', function() { | |
| setTimeout(addClassIfMissing, 900); | |
| }); | |
| // Run on step switching event (multi-step forms) | |
| $(document.body).on('wfacp_step_switching', function() { | |
| setTimeout(addClassIfMissing, 900); | |
| }); | |
| // Initial check | |
| $(document).ready(function() { | |
| setTimeout(addClassIfMissing, 500); | |
| }); | |
| })(jQuery); | |
| </script> | |
| <?php | |
| }, 30 ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment