Hi,
I encountered error notifications on the admin page after activating the Bricks Child/Bricks theme.
However, switching to the default WordPress theme, Twenty Twenty-Five, resolves the issue and my site functions smoothly.
I am currently utilizing FlyingPress, AffiliateWP, and WPML.
Is there anyone who can offer a solution to this problem?
jQuery.Deferred exception: Cannot read properties of null (reading 'addEventListener') TypeError: Cannot read properties of null (reading 'addEventListener')
Uncaught TypeError: Cannot read properties of null (reading 'addEventListener')
Thank you,
timmse
August 15, 2025, 8:32am
2
Hi Rio,
Thanks so much for your report!
Please disable all of your plugins, and check if the issue persist. Also, try with the parent theme itself. Theen, enable one plugin at a time until you find the culprit. In general it is strange that javascript errors are displayed in the wp admin area
Best regards,
timmse
Hi @timmse
I have disabled all plugins and switched to the parent theme, yet the issue continues to persist.
Warm regards,
Rio
timmse
August 18, 2025, 6:47am
4
Seems like this problem is back:
opened 07:36PM - 16 Jul 25 UTC
closed 12:22PM - 24 Jul 25 UTC
Bug
Settings
type: community contribution
### Prerequisites
- [x] I have carried out troubleshooting steps and I believe I⦠have found a bug.
- [x] I have searched for similar bugs in both open and closed issues and cannot find a duplicate.
### Describe the bug
In the WooCommerce admin settings panel (`WooCommerce > Settings > Accounts & Privacy`), a JavaScript error occurs when using a shortcode-based checkout (`[woocommerce_checkout]`) instead of Cart & Checkout Blocks. An inline JavaScript script attempts to attach an event listener to an `<a>` element with the class `delayed-account-creation-customize-link`. This element is not rendered in the DOM when the "After checkout (recommended)" option is disabled due to shortcode checkout, resulting in the following console error:
```
Uncaught TypeError: Cannot read properties of null (reading 'addEventListener')
at HTMLDocument.<anonymous> (admin.php?page=wc-settings&tab=account:2514:72)
at e (load-scripts.php?c=1&load%5Bchunk_0%5D=jquery-core,jquery-migrate,utils,jquery-ui-core,jquery-ui-tooltip,thickbox,underscore,shortcode,media-upload,jquery-ui-mouse,jqu&load%5Bchunk_1%5D=ery-ui-sortable,moxiejs,plupload&ver=6.8.2:2:27028)
at t (load-scripts.php?c=1&load%5Bchunk_0%5D=jquery-core,jquery-migrate,utils,jquery-ui-core,jquery-ui-tooltip,thickbox,underscore,shortcode,media-upload,jquery-ui-mouse,jqu&load%5Bchunk_1%5D=ery-ui-sortable,moxiejs,plupload&ver=6.8.2:2:27330)
```
The error occurs because the script does not check if the `<a>` element exists before calling `addEventListener`, which can disrupt other scripts in the admin panel.
### Expected behavior
The inline JavaScript script should check for the existence of the `<a>` element with class `delayed-account-creation-customize-link` before attempting to attach an event listener. If the element is not present (e.g., when shortcode checkout is used), the script should exit gracefully without throwing an error.
### Actual behavior
When the "After checkout (recommended)" option is disabled due to shortcode checkout, the `<a>` element with class `delayed-account-creation-customize-link` is not rendered in the DOM. Instead, a different `<a>` element with `href="https://woocommerce.com/document/woocommerce-store-editing/customizing-cart-and-checkout"` is displayed. The inline JavaScript script still attempts to attach an event listener to the non-existent `delayed-account-creation-customize-link` element, resulting in the following error:
```
jQuery.Deferred exception: Cannot read properties of null (reading 'addEventListener') TypeError: Cannot read properties of null (reading 'addEventListener')
at HTMLDocument.<anonymous> (https://localhost/wp-admin/admin.php?page=wc-settings&tab=account:2514:72)
```
### Steps to reproduce
1. Install WordPress 6.8.2 and WooCommerce 10.0.2.
2. Use a theme that implements the checkout page with the `[woocommerce_checkout]` shortcode (e.g., a custom theme or Storefront with shortcode-based checkout).
3. Go to `WooCommerce > Settings > Accounts & Privacy` (`wp-admin/admin.php?page=wc-settings&tab=account`).
4. Enable the "Allow customers to place orders without an account" (Guest checkout) option.
5. Observe that the "After checkout (recommended)" option is disabled with a tooltip: `Your store is using shortcode checkout. Use the Checkout blocks to activate this option.`
6. Open the browser console (F12) and check for the error:
```
Uncaught TypeError: Cannot read properties of null (reading 'addEventListener')
at HTMLDocument.<anonymous> (admin.php?page=wc-settings&tab=account:2514:72)
```
7. Inspect the DOM and confirm that the `<a>` element with class `delayed-account-creation-customize-link` is missing, replaced by:
```html
<p class="description">This feature is only available with the Cart & Checkout blocks. <a href="https://woocommerce.com/document/woocommerce-store-editing/customizing-cart-and-checkout">Learn more</a>.</p>
```
### WordPress Environment
<details>
<summary>WordPress Environment</summary>
```
### WordPress Environment ###
WordPress address (URL): http://localhost
Site address (URL): http://localhost
WC Version: 10.0.2
REST API Version: β 10.0.2
WC Blocks Version: β 10.0.2
Action Scheduler Version: β 3.8.0
Log Directory Writable: β
WP Version: 6.8.2
WP Multisite: β
WP Memory Limit: 256 MB
WP Debug Mode: β
WP Cron: β
Language: en_US
External object cache: β
### Server Environment ###
Server Info: Apache
PHP Version: 8.4.10
PHP Post Max Size: 32 MB
PHP Time Limit: 30
PHP Max Input Vars: 1000
cURL Version: 7.87.0
OpenSSL/1.1.1w
SUHOSIN Installed: β
MySQL Version: 5.7.39
Max Upload Size: 32 MB
Default Timezone is UTC: β
fsockopen/cURL: β
SoapClient: β
DOMDocument: β
GZip: β
Multibyte String: β
Remote Post: β
Remote Get: β
### Theme ###
Name: Custom Theme (or Storefront for testing)
Version: 1.0.0
Author URL: http://example.com
Child Theme: β
WooCommerce Support: β
### Templates ###
Overrides: None (or specify if applicable)
### Active Plugins ###
WooCommerce: by Automattic β 10.0.2
```
</details>
### Isolating the problem
- [x] I have deactivated other plugins and confirmed this bug occurs when only WooCommerce plugin is active.
- [x] This bug happens with a default WordPress theme active, or [Storefront](https://woocommerce.com/products/storefront/).
- [x] I can reproduce this bug consistently using the steps above.
### Additional context
- The issue was reproduced in a clean WordPress + WooCommerce installation with no additional plugins, confirming it is not caused by third-party plugins or themes.
- Switching to a block-based checkout (using Cart & Checkout Blocks) renders the `<a>` element with the `delayed-account-creation-customize-link` class, and the error does not occur.
- The issue is likely an oversight in WooCommerce 10.0.2, where the inline script is added without checking if the `delayed-account-creation-customize-link` element exists when shortcode checkout is used.
- Relevant code references:
- The `woocommerce_enable_delayed_account_creation` option is defined in `woocommerce/includes/admin/settings/class-wc-settings-accounts.php`.
- The problematic inline script is likely added in `woocommerce/assets/client/admin/wp-admin-scripts/settings-embed.js` or a related admin script.
### Suggested fix
Modify the inline JavaScript script to include a null check for the `delayed-account-creation-customize-link` element:
```javascript
document.addEventListener('DOMContentLoaded', function() {
const delayedLink = document.querySelector('a.delayed-account-creation-customize-link');
if (delayedLink) {
delayedLink.addEventListener('click', function() {
// Original event listener logic
});
}
});
```
### Workaround
As a temporary workaround, users can add the following JavaScript to their themeβs admin scripts to prevent the error:
```javascript
jQuery(document).ready(function($) {
const delayedLink = document.querySelector('a.delayed-account-creation-customize-link');
if (delayedLink) {
delayedLink.addEventListener('click', function() {
console.log('Delayed account creation link clicked');
});
}
});
```
This can be enqueued via the `admin_enqueue_scripts` hook for the `wc-settings&tab=account` page.
### Related issues
No similar issues were found in the WooCommerce GitHub repository for version 10.0.2, but this may be related to recent changes in the "Delayed Account Creation" feature introduced in WooCommerce 9.5+.
However, this is not a Bricks bug, because the error is caused by WooCommerce, but in my opinion can simply be ignored.