Skip to content

Commit

Permalink
Add button selector for the add to cart link
Browse files Browse the repository at this point in the history
  • Loading branch information
jorgemd24 committed Nov 24, 2023
1 parent 487625e commit b25b934
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion includes/class-wc-google-analytics-js.php
Original file line number Diff line number Diff line change
Expand Up @@ -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() ) . "',
Expand Down
2 changes: 1 addition & 1 deletion includes/class-wc-google-gtag-js.php
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down

0 comments on commit b25b934

Please sign in to comment.