If somone use GTM4WP plugin to send data layer.
And add_to_cart not send datalayer on product page.
wp-content\plugins\duracelltomi-google-tag-manager\integration\woocommerce.php
Change from:
wp_enqueue_script( 'gtm4wp-woocommerce', $gtp4wp_script_path . 'gtm4wp-woocommerce.js', array( 'jquery' ), GTM4WP_VERSION, $in_footer );
to:
wp_enqueue_script( 'gtm4wp-woocommerce', str_replace( '/dist/', '/', $gtp4wp_script_path ) . 'gtm4wp-woocommerce.js', array( 'jquery' ), GTM4WP_VERSION, $in_footer );
wp-content/plugins/duracelltomi-google-tag-manager/js/gtm4wp-woocommerce.js
// track add to cart events for products on product detail pages (line 250)
Change this line from:
if ( event_target_element.closest( '.single_add_to_cart_button:not(.disabled)' ) ) {
to:
if ( event_target_element.closest( '.single_add_to_cart_button' ) ) {
remove :not(.disabled)
And you have to add CSS:
body.single-product button.single_add_to_cart_button span {
pointer-events: none;
}
Please vote for this on gtm4wp plugin page: