• Resolved ventio

    (@ventio)


    I noticed that when using your plugin, the ‘add_to_cart’ event is not being sent through Google Tag Manager to GA4 when a product is added to the cart. I’m using the GTM4WP plugin to send events.

    I’ve tested this thoroughly, and when adding a product through a page where I use your plugin, ‘add_to_cart’ doesn’t work, but it functions correctly when adding without your plugin.

    <font style=”vertical-align: inherit;”><font style=”vertical-align: inherit;”>Czy mógłbym prosić o rozwiązanie tego problemu?</font></font>

    I have a paid version but when I wrote on your website I didn’t get a response.

Viewing 3 replies - 1 through 3 (of 3 total)
  • Plugin Author WPBean

    (@wpbean)

    Hi,

    So sorry for the late reply.

    We replied your ticket with this issue fixed.

    Please check this ticket: https://wpbean.freshdesk.com/a/tickets/8405

    Thank You

    Thread Starter ventio

    (@ventio)

    Here’s a solution for others with a similar problem. Please add this code to your theme or child theme functions.php file. It will fix this issue.

    if ( defined( 'GTM4WP_PATH' ) ) {
        add_action( 'init', function(){
            require_once GTM4WP_PATH . '/public/frontend.php';
            require_once GTM4WP_PATH . '/integration/woocommerce.php';
        } );
    }

    • This reply was modified 1 year, 4 months ago by ventio.
    Plugin Author WPBean

    (@wpbean)

    Good to know it fix the issue.

    And thanks for sharing the code here.

Viewing 3 replies - 1 through 3 (of 3 total)

The topic ‘Adding to cart does not trigger the add_to_cart event in GTM4WP’ is closed to new replies.