Skip to content

Instantly share code, notes, and snippets.

@xlplugins
Last active December 24, 2025 11:39
Show Gist options
  • Select an option

  • Save xlplugins/854212eda7040b66160a48f071c2f266 to your computer and use it in GitHub Desktop.

Select an option

Save xlplugins/854212eda7040b66160a48f071c2f266 to your computer and use it in GitHub Desktop.
Ensure wfacp-form-control class exists on billing state and city fields
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