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 }