Public Ticket #1947266
AddToCart WooCommerce Amely theme


  • Koenbeeren started the conversation

    Hi developers of Amely,

    For the website https://monsak.nl I tried to setup the whole enhanced e-commerce within the theme of Amely. I used the 'DuracellTomi's Google Tag Manager for Wordpress' plugin so that I can add datalayers to the code.

    Everything was setup correctly and was working good, except the AddToCart function. Unfortunately, I was unable to trigger the AddToCart and I didn’t find out what the problem was. Which is very weird, because RemoveFromCart do work..

    Then I asked the developer of the 'DuracellTomi's Google Tag Manager for Wordpress' plugin and he said that he found some JavaScript code in the theme directory that attaches extra event handler to the add to cart button to be able to add the product to the cart without reloading the page.

    This seems to use a return false statement which breaks other event handler codes, including the code in GTM4WP which results in a missing add to cart event tracking.

    He asked me if I can communicate with the theme developer to use event.preventDefault()instead of return false?

    You can look for further details: https://wordpress.org/support/topic/addtocart-dont-trigger-on-product-page/

    Is it possible to do that for me so that I can track everything properly? Or do you have a another solution to track the AddToCart? I think that more people will encounter this problem while using the Amely theme.

    I would like to hear from you!

    Kind regards,

    Koen Beeren

  •  875
    Linh replied


    I tried to remove item from the cart and it still working well.



  • Koenbeeren replied

    Hi Linh,

    It is not about the function of removing something from my shopping cart. That's working! Even as the AddToCart!

    But it is about getting these elements measurable with Google Tag Manager. I want to make the element AddToCart measurable. Is that possible?

    Look for instructions in the link below!

    Kind regards,


  •  875
    Linh replied


    We has not tested with Google Tag Manager. Almost our customer are using SEO Yoast and Google Analytic to track the code:  https://www.wpbeginner.com/beginners-guide/how-to-install-google-analytics-in-wordpress/