• Resolved mediteranija

    (@mediteranija)


    Hi guys,

    I’ve noticed that the Add To Cart event isn’t being pushed to the dataLayer anymore. It worked before for about a year, so I think it’s up to the latest GTM4WP update (or WC update).

    It happens only on custom pages, where the Add To Cart button has been coded manually.

    Thanks to Tomi, I got it to work before: link to the resolved ticket.

    All plugins and WP are updated to the latest version. Link to the website where this event isn’t triggered: https://pokanails.com/shop/

    I’ve implemented all necessary hooks to help GTM4WP to push an event, but if any of that hooks changed recently, that could be the issue?

Viewing 1 replies (of 1 total)
  • Thread Starter mediteranija

    (@mediteranija)

    RESOLVED

    First of all, it’s not a bug. BUT, it looks like something has changed during the last update – with GTM4WP or with WC.

    The GTM4WP wasn’t pushing Add To Cart event because it wasn’t creating an <span> element with the product’s data inside my loop.

    After I’ve added this line of code right before my Add To Cart button: <?php do_action( 'woocommerce_after_shop_loop_item' ); ?>, everything got back to normal.

    It’s a hook which isn’t documented here, but it’s need for GTM4WP to work on archive pages or inside product lists.

    Before the last updates, I didn’t have this hook inside my code and everything worked. I had only: <?php do_action( 'woocommerce_before_shop_loop_item' ); ?>, so maybe that was a change.

Viewing 1 replies (of 1 total)
  • The topic ‘Latest Update Bug? Add To Cart Event Isn’t Pushed Anymore’ is closed to new replies.