WPIntell

Source evidence

Function wc_enqueue_js deprecated since version 10.4.0!

GTM4WP – A Google Tag Manager (GTM) plugin for WordPress · support · 2026-03-03T16:03:00+00:00

complaintsentiment
highseverity
1.0relevance
2replies
Evidence linked to opportunitycommercial context

Proof Health

Open evidence

Commercial opportunities need traceable source links before they are treated as build-worthy.

5 / 31 rows with source links

16.1% of this page's analysis has direct source links.

0 build-decision rows missing links

0 rows here require auditable proof before promotion.

26 rows with no attached evidence

0 rows have source counts but still need direct links.

Conversation

support
srpnutratea unresolved
There 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!

Comments

2 shown
aiolosweb 2026-03-21T23:44:00+00:00

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!

flo_sb 2026-05-08T11:57:00+00:00

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!