From 391af06505056b28d6a83f5949107cdb685ad737 Mon Sep 17 00:00:00 2001 From: Mike Jolley Date: Thu, 19 Sep 2024 13:36:15 +0100 Subject: [PATCH] Check input exists --- .../includes/admin/settings/class-wc-settings-accounts.php | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/plugins/woocommerce/includes/admin/settings/class-wc-settings-accounts.php b/plugins/woocommerce/includes/admin/settings/class-wc-settings-accounts.php index 21491f2f59c..80afdedcf2d 100644 --- a/plugins/woocommerce/includes/admin/settings/class-wc-settings-accounts.php +++ b/plugins/woocommerce/includes/admin/settings/class-wc-settings-accounts.php @@ -365,7 +365,11 @@ class WC_Settings_Accounts extends WC_Settings_Page { if ( guestCheckout ) { guestCheckout.addEventListener('change', function() { const isChecked = this.checked; - document.getElementById("woocommerce_enable_delayed_account_creation").disabled = !isChecked; + const input = document.getElementById("woocommerce_enable_delayed_account_creation"); + if ( ! input ) { + return; + } + input.disabled = !isChecked; }); guestCheckout.dispatchEvent(new Event('change')); // Initial state }