Plugin: wpDataTables
Affected File: wdt.woo-commerce.min.js
Environment:
wpDataTables Version:7.3
WordPress Version: 6.8.2
WooCommerce Version: 10.0.4
Theme: Custom theme.
Detailed Issue Description
A fatal JavaScript error is occurring on all single WooCommerce product pages. The error originates from the wdt.woo-commerce.min.js script included with your plugin. This script appears to be running on pages where it shouldn’t, causing a conflict with the standard WooCommerce “Add to Cart” button.
Exact Error Message
The following error is consistently logged in the browser’s developer console on page load:
Uncaught TypeError: Cannot read properties of undefined (reading ‘id’)
at HTMLButtonElement.<anonymous> (wdt.woo-commerce.min.js?ver=7.3:13:201)
at HTMLBodyElement.dispatch (jquery.min.js?ver=3.7.1:2:40035)
at v.handle (jquery.min.js?ver=3.7.1:2:38006)
Steps to Reproduce
Ensure wpDataTables and WooCommerce are active on a WordPress site.
Navigate to any single WooCommerce product page on the front end.
Open the browser’s developer console.
The JavaScript error appears immediately upon page load.
Analysis of the Cause
The issue seems to be a contextual conflict. The wdt.woo-commerce.min.js script is designed to interact with WooCommerce products when they are displayed inside a wpDataTable. In that context, the script expects to find a specific data object associated with the Add to Cart button to get the product id.
However, this script is also being loaded on standard single product pages where no data table is present. On these pages, the Add to Cart button is a standard element and does not have the custom data the script is looking for. The script attempts to access the .id property on an undefined object, which causes it to crash.
Troubleshooting Steps Already Taken
We have confirmed this is a plugin issue and not a theme or other plugin conflict. We have attempted the following standard WordPress methods to resolve it, without success:
wp_dequeue_script: We attempted to dequeue the script using the correct handle (wdt-woo-commerce-js) on the wp_enqueue_scripts hook. We tried this at multiple priorities, including very late ones (999), but the script still loads. This suggests it is being added in a non-standard way that bypasses the enqueue system.
Workaround: The only successful workaround has been to use PHP’s output buffering (ob_start and ob_get_clean) to forcefully remove the <script> tag from the final HTML output of the page. While this stops the error, it is not an ideal or permanent solution.
Suggested Resolution
We recommend a permanent fix within the plugin. The two most logical solutions would be:
Conditional Loading: The wdt-woo-commerce.min.js script should only be enqueued on pages that actually contain a [wpdatatable] shortcode or are otherwise displaying a data table.
Defensive Coding: The script itself should be updated to first check if the data object it needs exists before attempting to access its properties. A simple if (data) check would prevent the script from crashing.
Thank you for your attention to this matter. We look forward to a resolution in a future update.

Hello,
Thank you for your time. We’ll forward your message to our support team for review. Since this page is intended for feature suggestions only, we will go ahead and close this request.
If you experience any issues or need further assistance in the future, please feel free to contact our support team directly through our website — it’s the fastest way to get help:
