diff --git a/includes/class-wc-google-analytics-js.php b/includes/class-wc-google-analytics-js.php index ee9708a9..acf80565 100644 --- a/includes/class-wc-google-analytics-js.php +++ b/includes/class-wc-google-analytics-js.php @@ -142,7 +142,7 @@ public static function listing_click( $product ) { wc_enqueue_js( " - $( '.product.post-" . esc_js( $product->get_id() ) . ' a , .product.post-' . esc_js( $product->get_id() ) . " button' ).on('click', function() { + $( '.product.post-" . esc_js( $product->get_id() ) . ' a.button , .product.post-' . esc_js( $product->get_id() ) . " button' ).on('click', function() { if ( false === $(this).hasClass( 'product_type_variable' ) && false === $(this).hasClass( 'product_type_grouped' ) ) { " . self::tracker_var() . "( 'ec:addProduct', { 'id': '" . esc_js( $product->get_id() ) . "', diff --git a/includes/class-wc-google-gtag-js.php b/includes/class-wc-google-gtag-js.php index 7724e46a..11786263 100644 --- a/includes/class-wc-google-gtag-js.php +++ b/includes/class-wc-google-gtag-js.php @@ -222,7 +222,7 @@ public static function listing_click( $product ) { wc_enqueue_js( " - $( '.product.post-" . esc_js( $product->get_id() ) . ' a , .product.post-' . esc_js( $product->get_id() ) . " button' ).on('click', function() { + $( '.product.post-" . esc_js( $product->get_id() ) . ' a.button , .product.post-' . esc_js( $product->get_id() ) . " button' ).on('click', function() { if ( false === $(this).hasClass( 'product_type_variable' ) && false === $(this).hasClass( 'product_type_grouped' ) ) { $add_to_cart_event_code } else {