Consider changing the behavior of the add_to_cart button script on the product p
-
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.
- You must be logged in to reply to this topic.