Tuesday, May 27, 2025
Testing Code Block

Nazmoon Munny

- Added a new code block type to your Sanity schema
- The code block supports:
- Multiple programming languages (JavaScript, TypeScript, HTML, CSS, etc.)
- Optional filename display
- Line highlighting capabilities
- Syntax highlighting
fix-login-enter-key-woocommerce.phpPHP
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
/**
* Fix for WooCommerce login form Enter key not working when registration is disabled
* This is a temporary fix until WooCommerce 9.9.9 is released (June 2, 2025)
*/
function fix_woocommerce_login_enter_key() {
// Only add this script on pages that might have the login form
if (!is_account_page() && !is_checkout()) {
return;
}
wp_add_inline_script('woocommerce', '
jQuery(function($) {
// Target all password inputs in login forms regardless of #customer_login existence
$(".woocommerce-form-login .password-input").on("keydown", function(event) {
if ("Enter" === event.key) {
$(this).closest("form").find("[type=submit]").click();
}
});
});
');
}
add_action('wp_enqueue_scripts', 'fix_woocommerce_login_enter_key', 99);
Fixes the issue where the Enter key doesn't submit the WooCommerce login form when user registration is disabled. Temporary workaround until WooCommerce 9.9.9 (June 2, 2025).