Skip to content

Instantly share code, notes, and snippets.

@iamsathyaseelan
Created January 12, 2021 07:20
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save iamsathyaseelan/02cfc84c971a90de1bc7cf4f966f89fa to your computer and use it in GitHub Desktop.
Save iamsathyaseelan/02cfc84c971a90de1bc7cf4f966f89fa to your computer and use it in GitHub Desktop.
auto trigger change in email field on page load to solve the issue in capturing loggedin user's details
<?php
add_filter("wp_footer",function(){
?>
<script>
document.addEventListener("DOMContentLoaded", function () {
let emailField = jQuery("input#billing_email");
if (emailField.length > 0) {
emailField.trigger("change");
}
});
</script>
<?php
},100);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment