Conversation
supportThere is an issue related to the deprecated function wc_enqueue_js() . You can read about it for example here: https://developer.woocommerce.com/2025/11/19/deprecation-of-wc_enqueue_js-in-10-4/ In the current version of your plugin, which is version 1.22.3 , this deprecated function is being used in the file: duracelltomi-google-tag-manager -> integration -> woocommerce.php …on line 799 It has been recommended by WooCommerce to replace wc_enqueue_js() with wp_add_inline_script() . Since version 10.5 WooCommerce is reporting the deprecated function calls in the PHP error_log file . And this results in the PHP error_log file being flooded with these warnings. Can you please kindly advise how to use the deprecated wc_enqueue_js() function? Kind regards, SP
Hello, I’m experiencing the exact same issue on my setup. Additional confirmation The deprecated call to wc_enqueue_js() is triggered via: gtm4wp_woocommerce_datalayer_filter_items() /integration/woocommerce.php:799 It appears during the gtm4wp_compile_datalayer process and is visible in Query Monitor. ⚠️ Impact In my case, this results in: Continuous deprecated warnings in logs Increased log size due to repeated calls Potential future compatibility risks with WooCommerce updates Environment WooCommerce: latest (10.5+) WordPress: latest GTM4WP: 1.22.3 CheckoutWC also active Would appreciate any update on: Planned fix timeline Recommended workaround (if any) Thank you!
Hi DuracellTomi, does in this file /wp-content/plugins/duracelltomi-google-tag-manager/integration/woocommerce.php Replacing this code: wc_enqueue_js( ' window.gtm4wp_checkout_products = ' . wp_json_encode( $gtm4wp_checkout_products ) . '; window.gtm4wp_checkout_value = ' . (float) $gtm4wp_checkout_total . ';' ); With this code wp_add_inline_script( 'gtm4wp-woocommerce', ' window.gtm4wp_checkout_products = ' . wp_json_encode( $gtm4wp_checkout_products ) . '; window.gtm4wp_checkout_value = ' . (float) $gtm4wp_checkout_total . ';', 'before' ); Work? Thanks!
Hello, I’m experiencing the exact same issue on my setup. Additional confirmation The deprecated call to wc_enqueue_js() is triggered via: gtm4wp_woocommerce_datalayer_filter_items() /integration/woocommerce.php:799 It appears during the gtm4wp_compile_datalayer process and is visible in Query Monitor. ⚠️ Impact In my case, this results in: Continuous deprecated warnings in logs Increased log size due to repeated calls Potential future compatibility risks with WooCommerce updates Environment WooCommerce: latest (10.5+) WordPress: latest GTM4WP: 1.22.3 CheckoutWC also active Would appreciate any update on: Planned fix timeline Recommended workaround (if any) Thank you!
Hi DuracellTomi, does in this file /wp-content/plugins/duracelltomi-google-tag-manager/integration/woocommerce.php Replacing this code: wc_enqueue_js( ' window.gtm4wp_checkout_products = ' . wp_json_encode( $gtm4wp_checkout_products ) . '; window.gtm4wp_checkout_value = ' . (float) $gtm4wp_checkout_total . ';' ); With this code wp_add_inline_script( 'gtm4wp-woocommerce', ' window.gtm4wp_checkout_products = ' . wp_json_encode( $gtm4wp_checkout_products ) . '; window.gtm4wp_checkout_value = ' . (float) $gtm4wp_checkout_total . ';', 'before' ); Work? Thanks!