Event add_to_cart not fired with user redirected directly to checkout
-
Hi,
We’ve been using your plugin for a while and recently we wanted to start tracking add_to_cart events. All the other events are working (view_item, view_item_list, begin_checkout, purchase and remove_from_cart) but add_to_cart don’t seem to be fired.
When checking via the developer tools, I can see calls getting sent to GA for all these events, but I never see the add_to_cart. Maybe this is because upon adding to cart, the website automatically redirects to the checkout page?
Here’s the code I use for this :
add_filter('woocommerce_add_to_cart_redirect', 'add_to_cart_redirect');
function add_to_cart_redirect() {
global $woocommerce;
return wc_get_checkout_url();
}And after checking the source code of your plugin, it seems the add_to_cart event is fired when the ‘woocommerce_add_to_cart’ WP action is getting triggered (source : class-wc-google-gtag-js.php, line 33).
Maybe this is not getting triggered with this specific situation?
Thanks for your help !
The page I need help with: [log in to see the link]
- You must be logged in to reply to this topic.