• Resolved mkdes

    (@mkdes)


    Please, consider changing the closest selector of the add_to_cart button script on the single product page.

    Into this file woocommerce.js

    From:

    if ( eventTargetElement.closest( '.single_add_to_cart_button:not(.disabled,.input-needed)' ) ) {

    To:

    if ( eventTargetElement.closest( '.single_add_to_cart_button' ) ) {

    Please, remove :not(.disabled,.input-needed)

    Especialy .disabled class.

    This occurs the dataLayer event is not send into shops using AJAX to adding product to cart.

    Because after click on the button, woocommerce add class .disabled to button, and then IF statement rule in this moment return FALSE, and script sending dataLayer not fire.

    I test this on shop page created with Bricks Builder, and add_to_cart event not trigger on single product page (no matter simple or variable product).

    I had to change your script and now add_to_cart event is send to dataLayer, and everything works fine.

    • This topic was modified 4 months, 1 week ago by mkdes.
Viewing 1 replies (of 1 total)
  • Plugin Author Torben Lundsgaard

    (@torbenlundsgaard)

    The GTM Kit follows the default WooCommerce theme, Storefront, as a standard. Most WordPress themes do the same. If I remove :not(.disabled,.input-needed) as you suggested, the GTM Kit would no longer be compatible with Storefront, which is a crucial requirement.

    While I strive to accommodate a wide range of themes and plugins, there will inevitably be some sites that are not compatible. For this reason, there is an option to dequeue the default JavaScript, allowing you to use your own custom script.

Viewing 1 replies (of 1 total)
  • You must be logged in to reply to this topic.